@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.
Files changed (77) hide show
  1. package/README.md +52 -35
  2. package/bin/cms.mjs +2 -0
  3. package/package.json +5 -5
  4. package/src/{Configuration-CA_jvQKG.js → Configuration-CDMYfTre.js} +3 -3
  5. package/src/{Configuration-CA_jvQKG.js.map → Configuration-CDMYfTre.js.map} +1 -1
  6. package/src/Configuration.d.ts +60 -2
  7. package/src/Configuration.js.map +1 -1
  8. package/src/ContentTransfer-C3Av9sWz.js +53 -0
  9. package/src/ContentTransfer-C3Av9sWz.js.map +1 -0
  10. package/src/{DocumentEngine-CgiBQU4g.js → DocumentEngine-J7g-emdf.js} +4 -4
  11. package/src/{DocumentEngine-CgiBQU4g.js.map → DocumentEngine-J7g-emdf.js.map} +1 -1
  12. package/src/DocumentModel.d.ts +33 -2
  13. package/src/{Forms-DxbkU3_5.js → Forms-Dj6NuW66.js} +2 -2
  14. package/src/{Forms-DxbkU3_5.js.map → Forms-Dj6NuW66.js.map} +1 -1
  15. package/src/Forms.d.ts +17 -1
  16. package/src/Forms.js.map +1 -1
  17. package/src/I18n.d.ts +20 -2
  18. package/src/Module.js +2 -3
  19. package/src/Module.js.map +1 -1
  20. package/src/{S3MediaObjects-JKMAWyVB.js → S3MediaObjects-CpPSzJto.js} +219 -106
  21. package/src/S3MediaObjects-CpPSzJto.js.map +1 -0
  22. package/src/cli/content.js +258 -0
  23. package/src/cli/content.js.map +1 -0
  24. package/src/cli.js +71 -0
  25. package/src/cli.js.map +1 -0
  26. package/src/{connection-B-iz0Y9Y.js → connection-CBAy2qGy.js} +2 -2
  27. package/src/{connection-B-iz0Y9Y.js.map → connection-CBAy2qGy.js.map} +1 -1
  28. package/src/{installation-DgF2M1gL.js → installation-CNfIriVm.js} +21 -23
  29. package/src/installation-CNfIriVm.js.map +1 -0
  30. package/src/internal/authoring-catalog.js +2 -2
  31. package/src/internal/authoring-metadata.js +1 -1
  32. package/src/internal/configuration.js +6 -10
  33. package/src/internal/configuration.js.map +1 -1
  34. package/src/internal/document-model.js +7 -4
  35. package/src/internal/document-model.js.map +1 -1
  36. package/src/{location-CFKTeK1K.js → location-BTqdfIzX.js} +2 -2
  37. package/src/{location-CFKTeK1K.js.map → location-BTqdfIzX.js.map} +1 -1
  38. package/src/{models-BWm1pTAf.js → models-B4IoTmp7.js} +2 -2
  39. package/src/{models-BWm1pTAf.js.map → models-B4IoTmp7.js.map} +1 -1
  40. package/src/{models-DwYioyNV.js → models-Bah5B3bT.js} +4 -21
  41. package/src/models-Bah5B3bT.js.map +1 -0
  42. package/src/runtime/delivery/context.js +1 -1
  43. package/src/runtime/delivery/plugin.js +9 -3
  44. package/src/runtime/delivery/plugin.js.map +1 -1
  45. package/src/runtime/delivery/useCmsDocumentSeo.d.ts +3 -0
  46. package/src/runtime/delivery/useCmsDocumentSeo.js +3 -1
  47. package/src/runtime/delivery/useCmsDocumentSeo.js.map +1 -1
  48. package/src/runtime/forms/document.js +1 -1
  49. package/src/runtime/forms/useCmsForm.js +43 -2
  50. package/src/runtime/forms/useCmsForm.js.map +1 -1
  51. package/src/runtime/i18n/translator.js +31 -2
  52. package/src/runtime/i18n/translator.js.map +1 -1
  53. package/src/runtime/i18n/useCmsI18n.d.ts +3 -1
  54. package/src/runtime/i18n/useCmsI18n.js +9 -1
  55. package/src/runtime/i18n/useCmsI18n.js.map +1 -1
  56. package/src/runtime/installation.js +1 -1
  57. package/src/runtime/plugin.js +3 -3
  58. package/src/runtime/plugin.js.map +1 -1
  59. package/src/runtime/preview/connection.js +1 -1
  60. package/src/runtime/preview/controller.js +2 -2
  61. package/src/runtime/preview/plugin.client.js +3 -3
  62. package/src/runtime/preview/store.js +1 -1
  63. package/src/runtime/sitemap.js +1 -1
  64. package/src/{store-DjJs3I7k.js → store-b2CSXgMt.js} +3 -3
  65. package/src/{store-DjJs3I7k.js.map → store-b2CSXgMt.js.map} +1 -1
  66. package/studio/{CreateDocumentDialog-CTeIFlPb.js → CreateDocumentDialog-GGey1uBc.js} +1 -1
  67. package/studio/{documentPlanning-Bfv-d7OU.js → documentPlanning-DRErYmBU.js} +1490 -1450
  68. package/studio/host.js +2 -2
  69. package/src/Configuration-Br7tE9Qt.d.ts +0 -68
  70. package/src/DocumentModel-BB9igGC7.d.ts +0 -34
  71. package/src/I18n-DZK4CkJF.d.ts +0 -21
  72. package/src/S3MediaObjects-JKMAWyVB.js.map +0 -1
  73. package/src/Seed.d.ts +0 -6
  74. package/src/Seed.js +0 -34
  75. package/src/Seed.js.map +0 -1
  76. package/src/installation-DgF2M1gL.js.map +0 -1
  77. package/src/models-DwYioyNV.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { n as formAuthoring } from "../Forms-DxbkU3_5.js";
2
- import { l as validateCollectionBody, n as ComponentDefinition, t as AuthoringCatalog } from "../Configuration-CA_jvQKG.js";
1
+ import { n as formAuthoring } from "../Forms-Dj6NuW66.js";
2
+ import { l as validateCollectionBody, n as ComponentDefinition, t as AuthoringCatalog } from "../Configuration-CDMYfTre.js";
3
3
  import { resolveBlockAuthoring } from "./authoring-metadata.js";
4
4
  import { Crypto, Effect, Encoding, FileSystem, Path, Schema } from "effect";
5
5
  import { addTemplate, addVitePlugin, updateTemplates } from "@nuxt/kit";
@@ -1,4 +1,4 @@
1
- import { a as BlockAuthoring, c as parseAuthoringContent, n as ComponentDefinition, s as createAuthoringSchema } from "../Configuration-CA_jvQKG.js";
1
+ import { a as BlockAuthoring, c as parseAuthoringContent, n as ComponentDefinition, s as createAuthoringSchema } from "../Configuration-CDMYfTre.js";
2
2
  import { compileCmsBlock, readAuthoringDefault } from "./authoring-compiler.js";
3
3
  import { Effect, Result, Schema } from "effect";
4
4
  import ts from "typescript";
@@ -1,8 +1,8 @@
1
1
  import { validateFormCapabilities } from "./form-capabilities.js";
2
- import { V as SeoConfiguration, u as DocumentImportSource } from "../models-DwYioyNV.js";
3
- import { j as StudioBootstrap, t as maxS3SingleCopyBytes, u as makeDefaultSeoOptions } from "../S3MediaObjects-JKMAWyVB.js";
2
+ import { R as SeoConfiguration } from "../models-Bah5B3bT.js";
3
+ import { j as StudioBootstrap, t as maxS3SingleCopyBytes, u as makeDefaultSeoOptions } from "../S3MediaObjects-CpPSzJto.js";
4
4
  import { compileCmsI18n } from "./i18n.js";
5
- import { i as PreviewOrigin } from "../models-BWm1pTAf.js";
5
+ import { i as PreviewOrigin } from "../models-B4IoTmp7.js";
6
6
  import { compileCmsDocumentModel } from "./document-model.js";
7
7
  import { Predicate, Result, Schema } from "effect";
8
8
 
@@ -41,7 +41,7 @@ const InstallationConfiguration = Schema.Struct({
41
41
  seo: Schema.optionalKey(SeoConfiguration),
42
42
  secret: Schema.NonEmptyString.check(Schema.isMinLength(32))
43
43
  });
44
- function compileCmsConfiguration(configuration, initialSources = []) {
44
+ function compileCmsConfiguration(configuration) {
45
45
  const decodedConfiguration = Schema.decodeResult(InstallationConfiguration)(configuration);
46
46
  if (Result.isFailure(decodedConfiguration)) throw new Error(`Invalid CMS configuration: ${String(decodedConfiguration.failure)}`);
47
47
  for (const [name, form] of Object.entries(configuration.forms ?? {})) {
@@ -51,18 +51,15 @@ function compileCmsConfiguration(configuration, initialSources = []) {
51
51
  }
52
52
  const i18n = compileCmsI18n(configuration.i18n);
53
53
  const documents = compileCmsDocumentModel(configuration.documents, configuration.i18n);
54
- const decodedSources = Schema.decodeResult(Schema.Array(DocumentImportSource))(initialSources);
55
- if (Result.isFailure(decodedSources)) throw new Error(`Invalid CMS initial sources: ${String(decodedSources.failure)}`);
56
54
  return {
57
55
  i18n,
58
56
  documentModel: documents.executable,
59
57
  documents: documents.authoring,
60
- initialSources: decodedSources.success,
61
58
  installation: decodedConfiguration.success
62
59
  };
63
60
  }
64
- function resolveCmsInstallation(authored, authoring, initialSources = []) {
65
- const compiled = compileCmsConfiguration(authored, initialSources);
61
+ function resolveCmsInstallation(authored, authoring) {
62
+ const compiled = compileCmsConfiguration(authored);
66
63
  const configuration = compiled.installation;
67
64
  const cleanup = configuration.cleanup === false ? void 0 : configuration.cleanup;
68
65
  const media = configuration.media === false ? void 0 : configuration.media;
@@ -88,7 +85,6 @@ function resolveCmsInstallation(authored, authoring, initialSources = []) {
88
85
  },
89
86
  databaseUrl: configuration.databaseUrl,
90
87
  documentModel: compiled.documentModel,
91
- initialSources: compiled.initialSources,
92
88
  initializationToken: configuration.initializationToken,
93
89
  ...media === void 0 ? void 0 : { media: {
94
90
  publicBaseUrl: media.publicBaseUrl,
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","names":["PreviewOriginSchema","DocumentImportSourceSchema"],"sources":["../../../../src/internal/configuration.ts"],"sourcesContent":["import { compileCmsI18n, type CompiledCmsI18n } from './i18n'\nimport type { ExecutableDocumentModel } from '@internal/document/DocumentEngine'\nimport type { AuthoringCatalog, DocumentConfiguration } from '@internal/protocol/Configuration'\nimport type { DocumentImportSource } from '@internal/protocol/Documents'\nimport type { CmsConfiguration, CmsInitialDocument } from '../Configuration'\nimport type { NuxtCmsInstallationOptions } from '../runtime/installation'\nimport { DocumentImportSource as DocumentImportSourceSchema } from '@internal/protocol/Documents'\nimport { PreviewOrigin as PreviewOriginSchema } from '@internal/protocol/Preview'\nimport { StudioBootstrap } from '@internal/protocol/StudioHttp'\nimport { SeoConfiguration } from '@internal/protocol/Seo'\nimport { makeDefaultSeoOptions } from '@internal/server/Seo'\nimport { maxS3SingleCopyBytes } from '@internal/s3/S3MediaObjects'\nimport { Predicate, Result, Schema } from 'effect'\nimport { compileCmsDocumentModel } from './document-model'\nimport { validateFormCapabilities } from './form-capabilities'\n\nconst DEFAULT_CLEANUP_INTERVAL_MILLIS = 24 * 60 * 60_000\n\nconst DEFAULT_CLEANUP_INITIAL_DELAY_MILLIS = 60_000\n\nconst DEFAULT_MEDIA_MAX_UPLOAD_BYTES = 10_000_000\n\nconst optionalString = Schema.optionalKey(Schema.NonEmptyString)\n\nconst InstallationConfiguration = Schema.Struct({\n baseUrl: PreviewOriginSchema,\n cleanup: Schema.optionalKey(\n Schema.Union([\n Schema.Literals([false]),\n Schema.Struct({\n initialDelayMillis: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n intervalMillis: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),\n }),\n ]),\n ),\n databaseUrl: Schema.NonEmptyString,\n initializationToken: Schema.NonEmptyString.check(Schema.isMinLength(32)),\n media: Schema.optionalKey(\n Schema.Union([\n Schema.Literals([false]),\n Schema.Struct({\n maxUploadBytes: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: maxS3SingleCopyBytes })),\n ),\n publicBaseUrl: Schema.NonEmptyString,\n storage: Schema.Struct({\n bucket: Schema.NonEmptyString,\n credentials: Schema.optionalKey(\n Schema.Struct({\n accessKeyId: Schema.NonEmptyString,\n secretAccessKey: Schema.NonEmptyString,\n sessionToken: optionalString,\n }),\n ),\n endpoint: optionalString,\n forcePathStyle: Schema.optionalKey(Schema.Boolean),\n provisionBucket: Schema.optionalKey(Schema.Boolean),\n region: Schema.NonEmptyString,\n }),\n }),\n ]),\n ),\n seo: Schema.optionalKey(SeoConfiguration),\n secret: Schema.NonEmptyString.check(Schema.isMinLength(32)),\n})\n\ntype CmsInstallationConfiguration = Schema.Schema.Type<typeof InstallationConfiguration>\n\nexport interface CompiledCmsConfiguration {\n readonly i18n: CompiledCmsI18n\n readonly documents: DocumentConfiguration\n readonly documentModel: ExecutableDocumentModel\n readonly initialSources: ReadonlyArray<DocumentImportSource>\n readonly installation: CmsInstallationConfiguration\n}\n\nexport function compileCmsConfiguration(\n configuration: CmsConfiguration,\n initialSources: ReadonlyArray<CmsInitialDocument> = [],\n): CompiledCmsConfiguration {\n const decodedConfiguration = Schema.decodeResult(InstallationConfiguration)(configuration)\n\n if (Result.isFailure(decodedConfiguration)) {\n throw new Error(`Invalid CMS configuration: ${String(decodedConfiguration.failure)}`)\n }\n\n for (const [name, form] of Object.entries(configuration.forms ?? {})) {\n if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(name))\n throw new Error(`Form ${name} needs a kebab-case Vue component name.`)\n validateFormCapabilities(form.definition)\n\n if (!Predicate.isFunction(form.onSubmit)) throw new Error(`Form ${name} needs a server submission handler.`)\n }\n\n const i18n = compileCmsI18n(configuration.i18n)\n const documents = compileCmsDocumentModel(configuration.documents, configuration.i18n)\n const decodedSources = Schema.decodeResult(Schema.Array(DocumentImportSourceSchema))(initialSources)\n\n if (Result.isFailure(decodedSources)) {\n throw new Error(`Invalid CMS initial sources: ${String(decodedSources.failure)}`)\n }\n\n return {\n i18n,\n documentModel: documents.executable,\n documents: documents.authoring,\n initialSources: decodedSources.success,\n installation: decodedConfiguration.success,\n }\n}\n\nexport function resolveCmsInstallation(\n authored: CmsConfiguration,\n authoring: AuthoringCatalog,\n initialSources: ReadonlyArray<CmsInitialDocument> = [],\n): NuxtCmsInstallationOptions {\n const compiled = compileCmsConfiguration(authored, initialSources)\n const configuration = compiled.installation\n const cleanup = configuration.cleanup === false ? undefined : configuration.cleanup\n const media = configuration.media === false ? undefined : configuration.media\n\n const bootstrap = Result.getOrThrow(\n Schema.decodeResult(StudioBootstrap)({\n basePath: '/',\n documents: compiled.documents,\n media: {\n enabled: media !== undefined,\n maxUploadBytes: media?.maxUploadBytes ?? DEFAULT_MEDIA_MAX_UPLOAD_BYTES,\n },\n seo: configuration.seo ?? makeDefaultSeoOptions(configuration.baseUrl),\n version: '1',\n }),\n )\n\n return {\n formHandlers: Object.fromEntries(Object.entries(authored.forms ?? {}).map(([name, form]) => [name, form.onSubmit])),\n authoring,\n baseUrl: configuration.baseUrl,\n bootstrap,\n cleanup: {\n enabled: configuration.cleanup !== false,\n initialDelayMillis: cleanup?.initialDelayMillis ?? DEFAULT_CLEANUP_INITIAL_DELAY_MILLIS,\n intervalMillis: cleanup?.intervalMillis ?? DEFAULT_CLEANUP_INTERVAL_MILLIS,\n },\n databaseUrl: configuration.databaseUrl,\n documentModel: compiled.documentModel,\n initialSources: compiled.initialSources,\n initializationToken: configuration.initializationToken,\n ...(media === undefined\n ? undefined\n : {\n media: {\n publicBaseUrl: media.publicBaseUrl,\n ...media.storage,\n forcePathStyle: media.storage.forcePathStyle ?? false,\n provisionBucket: media.storage.provisionBucket ?? false,\n },\n }),\n secret: configuration.secret,\n }\n}\n"],"mappings":";;;;;;;;;AAgBA,MAAM,kCAAkC;AAExC,MAAM,uCAAuC;AAE7C,MAAM,iCAAiC;AAEvC,MAAM,iBAAiB,OAAO,YAAY,OAAO,cAAc;AAE/D,MAAM,4BAA4B,OAAO,OAAO;CAC9C,SAASA;CACT,SAAS,OAAO,YACd,OAAO,MAAM,CACX,OAAO,SAAS,CAAC,KAAK,CAAC,GACvB,OAAO,OAAO;EACZ,oBAAoB,OAAO,YAAY,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC,CAAC;EACzF,gBAAgB,OAAO,YAAY,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC,CAAC;CAC9E,CAAC,CACH,CAAC,CACH;CACA,aAAa,OAAO;CACpB,qBAAqB,OAAO,eAAe,MAAM,OAAO,YAAY,EAAE,CAAC;CACvE,OAAO,OAAO,YACZ,OAAO,MAAM,CACX,OAAO,SAAS,CAAC,KAAK,CAAC,GACvB,OAAO,OAAO;EACZ,gBAAgB,OAAO,YACrB,OAAO,IAAI,MAAM,OAAO,UAAU;GAAE,SAAS;GAAG,SAAS;EAAqB,CAAC,CAAC,CAClF;EACA,eAAe,OAAO;EACtB,SAAS,OAAO,OAAO;GACrB,QAAQ,OAAO;GACf,aAAa,OAAO,YAClB,OAAO,OAAO;IACZ,aAAa,OAAO;IACpB,iBAAiB,OAAO;IACxB,cAAc;GAChB,CAAC,CACH;GACA,UAAU;GACV,gBAAgB,OAAO,YAAY,OAAO,OAAO;GACjD,iBAAiB,OAAO,YAAY,OAAO,OAAO;GAClD,QAAQ,OAAO;EACj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AO,aAAa,eAAe,CAAC,CAAC;EACnC,UAAU;EACV,WAAW,SAAS;EACpB,OAAO;GACL,SAAS,UAAU;GACnB,gBAAgB,OAAO,kBAAkB;EAC3C;EACA,KAAK,cAAc,OAAO,sBAAsB,cAAc,OAAO;EACrE,SAAS;CACX,CAAC,CACH;CAEA,OAAO;EACL,cAAc,OAAO,YAAY,OAAO,QAAQ,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,UAAU,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;EAClH;EACA,SAAS,cAAc;EACvB;EACA,SAAS;GACP,SAAS,cAAc,YAAY;GACnC,oBAAoB,SAAS,sBAAsB;GACnD,gBAAgB,SAAS,kBAAkB;EAC7C;EACA,aAAa,cAAc;EAC3B,eAAe,SAAS;EACxB,gBAAgB,SAAS;EACzB,qBAAqB,cAAc;EACnC,GAAI,UAAU,SACV,SACA,EACE,OAAO;GACL,eAAe,MAAM;GACrB,GAAG,MAAM;GACT,gBAAgB,MAAM,QAAQ,kBAAkB;GAChD,iBAAiB,MAAM,QAAQ,mBAAmB;EACpD,EACF;EACJ,QAAQ,cAAc;CACxB;AACF"}
1
+ {"version":3,"file":"configuration.js","names":["PreviewOriginSchema"],"sources":["../../../../src/internal/configuration.ts"],"sourcesContent":["import { compileCmsI18n, type CompiledCmsI18n } from './i18n'\nimport type { ExecutableDocumentModel } from '@internal/document/DocumentEngine'\nimport type { AuthoringCatalog, DocumentConfiguration } from '@internal/protocol/Configuration'\nimport type { CmsConfiguration } from '../Configuration'\nimport type { NuxtCmsInstallationOptions } from '../runtime/installation'\nimport { PreviewOrigin as PreviewOriginSchema } from '@internal/protocol/Preview'\nimport { StudioBootstrap } from '@internal/protocol/StudioHttp'\nimport { SeoConfiguration } from '@internal/protocol/Seo'\nimport { makeDefaultSeoOptions } from '@internal/server/Seo'\nimport { maxS3SingleCopyBytes } from '@internal/s3/S3MediaObjects'\nimport { Predicate, Result, Schema } from 'effect'\nimport { compileCmsDocumentModel } from './document-model'\nimport { validateFormCapabilities } from './form-capabilities'\n\nconst DEFAULT_CLEANUP_INTERVAL_MILLIS = 24 * 60 * 60_000\n\nconst DEFAULT_CLEANUP_INITIAL_DELAY_MILLIS = 60_000\n\nconst DEFAULT_MEDIA_MAX_UPLOAD_BYTES = 10_000_000\n\nconst optionalString = Schema.optionalKey(Schema.NonEmptyString)\n\nconst InstallationConfiguration = Schema.Struct({\n baseUrl: PreviewOriginSchema,\n cleanup: Schema.optionalKey(\n Schema.Union([\n Schema.Literals([false]),\n Schema.Struct({\n initialDelayMillis: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n intervalMillis: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),\n }),\n ]),\n ),\n databaseUrl: Schema.NonEmptyString,\n initializationToken: Schema.NonEmptyString.check(Schema.isMinLength(32)),\n media: Schema.optionalKey(\n Schema.Union([\n Schema.Literals([false]),\n Schema.Struct({\n maxUploadBytes: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: maxS3SingleCopyBytes })),\n ),\n publicBaseUrl: Schema.NonEmptyString,\n storage: Schema.Struct({\n bucket: Schema.NonEmptyString,\n credentials: Schema.optionalKey(\n Schema.Struct({\n accessKeyId: Schema.NonEmptyString,\n secretAccessKey: Schema.NonEmptyString,\n sessionToken: optionalString,\n }),\n ),\n endpoint: optionalString,\n forcePathStyle: Schema.optionalKey(Schema.Boolean),\n provisionBucket: Schema.optionalKey(Schema.Boolean),\n region: Schema.NonEmptyString,\n }),\n }),\n ]),\n ),\n seo: Schema.optionalKey(SeoConfiguration),\n secret: Schema.NonEmptyString.check(Schema.isMinLength(32)),\n})\n\ntype CmsInstallationConfiguration = Schema.Schema.Type<typeof InstallationConfiguration>\n\nexport interface CompiledCmsConfiguration {\n readonly i18n: CompiledCmsI18n\n readonly documents: DocumentConfiguration\n readonly documentModel: ExecutableDocumentModel\n readonly installation: CmsInstallationConfiguration\n}\n\nexport function compileCmsConfiguration(configuration: CmsConfiguration): CompiledCmsConfiguration {\n const decodedConfiguration = Schema.decodeResult(InstallationConfiguration)(configuration)\n\n if (Result.isFailure(decodedConfiguration)) {\n throw new Error(`Invalid CMS configuration: ${String(decodedConfiguration.failure)}`)\n }\n\n for (const [name, form] of Object.entries(configuration.forms ?? {})) {\n if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(name))\n throw new Error(`Form ${name} needs a kebab-case Vue component name.`)\n validateFormCapabilities(form.definition)\n\n if (!Predicate.isFunction(form.onSubmit)) throw new Error(`Form ${name} needs a server submission handler.`)\n }\n\n const i18n = compileCmsI18n(configuration.i18n)\n const documents = compileCmsDocumentModel(configuration.documents, configuration.i18n)\n\n return {\n i18n,\n documentModel: documents.executable,\n documents: documents.authoring,\n installation: decodedConfiguration.success,\n }\n}\n\nexport function resolveCmsInstallation(\n authored: CmsConfiguration,\n authoring: AuthoringCatalog,\n): NuxtCmsInstallationOptions {\n const compiled = compileCmsConfiguration(authored)\n const configuration = compiled.installation\n const cleanup = configuration.cleanup === false ? undefined : configuration.cleanup\n const media = configuration.media === false ? undefined : configuration.media\n\n const bootstrap = Result.getOrThrow(\n Schema.decodeResult(StudioBootstrap)({\n basePath: '/',\n documents: compiled.documents,\n media: {\n enabled: media !== undefined,\n maxUploadBytes: media?.maxUploadBytes ?? DEFAULT_MEDIA_MAX_UPLOAD_BYTES,\n },\n seo: configuration.seo ?? makeDefaultSeoOptions(configuration.baseUrl),\n version: '1',\n }),\n )\n\n return {\n formHandlers: Object.fromEntries(Object.entries(authored.forms ?? {}).map(([name, form]) => [name, form.onSubmit])),\n authoring,\n baseUrl: configuration.baseUrl,\n bootstrap,\n cleanup: {\n enabled: configuration.cleanup !== false,\n initialDelayMillis: cleanup?.initialDelayMillis ?? DEFAULT_CLEANUP_INITIAL_DELAY_MILLIS,\n intervalMillis: cleanup?.intervalMillis ?? DEFAULT_CLEANUP_INTERVAL_MILLIS,\n },\n databaseUrl: configuration.databaseUrl,\n documentModel: compiled.documentModel,\n initializationToken: configuration.initializationToken,\n ...(media === undefined\n ? undefined\n : {\n media: {\n publicBaseUrl: media.publicBaseUrl,\n ...media.storage,\n forcePathStyle: media.storage.forcePathStyle ?? false,\n provisionBucket: media.storage.provisionBucket ?? false,\n },\n }),\n secret: configuration.secret,\n }\n}\n"],"mappings":";;;;;;;;;AAcA,MAAM,kCAAkC;AAExC,MAAM,uCAAuC;AAE7C,MAAM,iCAAiC;AAEvC,MAAM,iBAAiB,OAAO,YAAY,OAAO,cAAc;AAE/D,MAAM,4BAA4B,OAAO,OAAO;CAC9C,SAASA;CACT,SAAS,OAAO,YACd,OAAO,MAAM,CACX,OAAO,SAAS,CAAC,KAAK,CAAC,GACvB,OAAO,OAAO;EACZ,oBAAoB,OAAO,YAAY,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC,CAAC;EACzF,gBAAgB,OAAO,YAAY,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC,CAAC;CAC9E,CAAC,CACH,CAAC,CACH;CACA,aAAa,OAAO;CACpB,qBAAqB,OAAO,eAAe,MAAM,OAAO,YAAY,EAAE,CAAC;CACvE,OAAO,OAAO,YACZ,OAAO,MAAM,CACX,OAAO,SAAS,CAAC,KAAK,CAAC,GACvB,OAAO,OAAO;EACZ,gBAAgB,OAAO,YACrB,OAAO,IAAI,MAAM,OAAO,UAAU;GAAE,SAAS;GAAG,SAAS;EAAqB,CAAC,CAAC,CAClF;EACA,eAAe,OAAO;EACtB,SAAS,OAAO,OAAO;GACrB,QAAQ,OAAO;GACf,aAAa,OAAO,YAClB,OAAO,OAAO;IACZ,aAAa,OAAO;IACpB,iBAAiB,OAAO;IACxB,cAAc;GAChB,CAAC,CACH;GACA,UAAU;GACV,gBAAgB,OAAO,YAAY,OAAO,OAAO;GACjD,iBAAiB,OAAO,YAAY,OAAO,OAAO;GAClD,QAAQ,OAAO;EACjB,CAAC;CACH,CAAC,CACH,CA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C,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,UAAU,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;EAClH;EACA,SAAS,cAAc;EACvB;EACA,SAAS;GACP,SAAS,cAAc,YAAY;GACnC,oBAAoB,SAAS,sBAAsB;GACnD,gBAAgB,SAAS,kBAAkB;EAC7C;EACA,aAAa,cAAc;EAC3B,eAAe,SAAS;EACxB,qBAAqB,cAAc;EACnC,GAAI,UAAU,SACV,SACA,EACE,OAAO;GACL,eAAe,MAAM;GACrB,GAAG,MAAM;GACT,gBAAgB,MAAM,QAAQ,kBAAkB;GAChD,iBAAiB,MAAM,QAAQ,mBAAmB;EACpD,EACF;EACJ,QAAQ,cAAc;CACxB;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { FIELD_INPUT_METADATA } from "./field-metadata.js";
2
- import { r as DocumentConfiguration } from "../Configuration-CA_jvQKG.js";
3
- import { t as createDocumentEngine } from "../DocumentEngine-CgiBQU4g.js";
4
- import { Effect, Result, Schema } from "effect";
2
+ import { r as DocumentConfiguration } from "../Configuration-CDMYfTre.js";
3
+ import { t as createDocumentEngine } from "../DocumentEngine-J7g-emdf.js";
4
+ import { Effect, Predicate, Result, Schema } from "effect";
5
5
 
6
6
  //#region src/internal/document-model.ts
7
7
  const isJsonObject = Schema.is(Schema.JsonObject);
@@ -47,7 +47,10 @@ function compileCollection(collection, options) {
47
47
  ...document.schema,
48
48
  $defs: document.definitions
49
49
  };
50
- } else generated = options.schema["~standard"].jsonSchema.input({ target: "draft-2020-12" });
50
+ } else {
51
+ if (!Predicate.isFunction(options.schema["~standard"]?.jsonSchema?.input)) throw new Error("Studio needs Standard JSON Schema V1 input conversion (or an adapter that supplies it).");
52
+ generated = options.schema["~standard"].jsonSchema.input({ target: "draft-2020-12" });
53
+ }
51
54
  } catch (cause) {
52
55
  throw invalid(`${path}.schema`, cause instanceof Error ? cause.message : String(cause));
53
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"document-model.js","names":[],"sources":["../../../../src/internal/document-model.ts"],"sourcesContent":["import type { CmsI18nOptions } from '../I18n'\nimport type { StandardJSONSchemaV1 } from 'effect/StandardSchema'\nimport type {\n DocumentSchemaProjection,\n ExecutableDocumentModel,\n ExecutableDocumentSchema,\n} from '@internal/document/DocumentEngine'\nimport type {\n DocumentConfiguration as DocumentConfigurationType,\n DocumentField,\n} from '@internal/protocol/Configuration'\nimport type {\n CmsCollectionOptions,\n CmsCollectionSchema,\n CmsDocumentModelOptions,\n CmsFieldInput,\n} from '../DocumentModel'\nimport { createDocumentEngine } from '@internal/document/DocumentEngine'\nimport { DocumentConfiguration } from '@internal/protocol/Configuration'\nimport { Effect, Result, Schema } from 'effect'\nimport { FIELD_INPUT_METADATA } from './field-metadata'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\ntype EncodedDocumentConfiguration = Schema.Codec.Encoded<typeof DocumentConfiguration>\n\ninterface CmsDocumentModel {\n readonly authoring: DocumentConfigurationType\n readonly executable: ExecutableDocumentModel\n}\n\ninterface CompiledCollection {\n readonly authoring: EncodedDocumentConfiguration['types'][number]\n readonly executable: ExecutableDocumentSchema\n}\n\nexport class CmsDocumentModelInvalid extends Schema.TaggedError<CmsDocumentModelInvalid>()('Cms.DocumentModelInvalid', {\n message: Schema.NonEmptyString,\n path: Schema.NonEmptyString,\n}) {}\n\nconst isCmsDocumentModelInvalid = Schema.is(CmsDocumentModelInvalid)\n\nexport function compileCmsDocumentModel(documents: CmsDocumentModelOptions, i18n?: CmsI18nOptions): CmsDocumentModel {\n try {\n const compiled = Object.entries(documents.collections).map(([collection, options]) =>\n compileCollection(collection, options),\n )\n\n const decoded = Schema.decodeResult(DocumentConfiguration)({\n ...(i18n === undefined\n ? undefined\n : {\n locales: {\n defaultLocale: i18n.defaultLocale,\n fallbackLocale: i18n.fallbackLocale ?? null,\n locales: Object.keys(i18n.locales),\n prefixDefaultLocale: i18n.prefixDefaultLocale ?? false,\n },\n }),\n types: compiled.map((entry) => entry.authoring),\n })\n\n if (Result.isFailure(decoded)) throw invalid('documents', String(decoded.failure))\n\n const model = {\n authoring: decoded.success,\n executable: {\n types: Object.fromEntries(compiled.map((entry) => [entry.authoring.collection, entry.executable])),\n },\n }\n\n const engine = Effect.runSync(\n Effect.result(createDocumentEngine(model.authoring, { documentModel: model.executable })),\n )\n\n if (Result.isFailure(engine)) throw invalid('documents', engine.failure.message)\n\n return model\n } catch (cause) {\n throw isCmsDocumentModelInvalid(cause)\n ? cause\n : invalid('documents.collections', cause instanceof Error ? cause.message : String(cause))\n }\n}\n\nfunction compileCollection(collection: string, options: CmsCollectionOptions): CompiledCollection {\n const path = `documents.collections.${collection}`\n let generated: ReturnType<StandardJSONSchemaV1.Converter['input']>\n\n try {\n if (isEffectCollectionSchema(options.schema)) {\n const document = Schema.toJsonSchemaDocument(options.schema, {\n includeAnnotationKey: (key) => key === FIELD_INPUT_METADATA,\n referencePolicy: () => undefined,\n })\n\n generated = { ...document.schema, $defs: document.definitions }\n } else {\n generated = options.schema['~standard'].jsonSchema.input({ target: 'draft-2020-12' })\n }\n } catch (cause) {\n throw invalid(`${path}.schema`, cause instanceof Error ? cause.message : String(cause))\n }\n\n const decoded = Schema.decodeUnknownResult(Schema.JsonObject)(generated)\n\n if (Result.isFailure(decoded)) throw invalid(`${path}.schema`, 'The generated input structure is not serializable.')\n const input = resolveInputStructure(decoded.success, `${path}.schema`)\n\n if (input.type !== 'object') throw invalid(`${path}.schema`, 'A collection schema must describe an object input.')\n const projection = compileProjection(input, `${path}.schema`)\n\n const validator = isEffectCollectionSchema(options.schema)\n ? Schema.toStandardSchemaV1(options.schema)\n : options.schema\n\n return {\n authoring: {\n addressPattern: options.route,\n ...(options.body === undefined ? undefined : { body: options.body }),\n authoringFields: compileAuthoringFields(input, `${path}.schema`),\n canCreate: options.canCreate ?? true,\n collection,\n description: options.description ?? '',\n directory: options.source ?? collection,\n hierarchy: options.hierarchy ?? options.route.includes('*'),\n label: options.label,\n },\n executable: {\n project: projection,\n validate: (value) => Effect.tryPromise(() => Promise.resolve(validator['~standard'].validate(value))),\n },\n }\n}\n\ntype ProjectDocumentProjection = (input: Schema.JsonObject) => DocumentSchemaProjection\n\nfunction compileProjection(schema: Schema.JsonObject, path: string, parent = ''): ProjectDocumentProjection {\n const properties = objectKeyword(schema, 'properties', path, true)\n\n const declarations = new Map(\n Object.entries(properties).map(([name, value]) => {\n const fieldPath = parent ? `${parent}.${name}` : name\n const property = requireObject(value, `${path}.${name}`)\n const nested = property.type === 'object' ? compileProjection(property, `${path}.${name}`, fieldPath) : undefined\n\n return [name, nested] as const\n }),\n )\n\n return (input) => {\n const value: Record<string, Schema.Json> = {}\n const unknownPaths: string[] = []\n\n for (const [name, child] of Object.entries(input)) {\n const nested = declarations.get(name)\n\n if (!declarations.has(name)) {\n unknownPaths.push(parent ? `${parent}.${name}` : name)\n } else if (nested && isJsonObject(child)) {\n const projected = nested(child)\n value[name] = projected.value\n unknownPaths.push(...projected.unknownPaths)\n } else {\n value[name] = child\n }\n }\n\n return { unknownPaths, value }\n }\n}\n\nfunction compileAuthoringFields(\n schema: Schema.JsonObject,\n path: string,\n parent = '',\n parentRequired = true,\n): ReadonlyArray<DocumentField> {\n const properties = objectKeyword(schema, 'properties', path, true)\n const required = stringArrayKeyword(schema, 'required', path)\n\n return Object.entries(properties).flatMap(([name, value]) => {\n if (!name || name.includes('.')) {\n throw invalid(`${path}.${name || '<empty>'}`, 'Field names must be non-empty and cannot contain dots.')\n }\n\n const fieldPath = parent ? `${parent}.${name}` : name\n\n if (fieldPath === 'id') throw invalid(`${path}.id`, 'Field \"id\" is reserved for CMS identity.')\n const property = requireObject(value, `${path}.${name}`)\n const fieldRequired = parentRequired && required.has(name)\n\n if (property.type === 'object') {\n if (property.default !== undefined) {\n throw invalid(\n `${path}.${name}`,\n 'Defaults on object fields are not supported; default their leaf fields instead.',\n )\n }\n\n return compileAuthoringFields(property, `${path}.${name}`, fieldPath, fieldRequired)\n }\n\n return [compileAuthoringField(property, `${path}.${name}`, fieldPath, fieldRequired)]\n })\n}\n\nfunction compileAuthoringField(\n schema: Schema.JsonObject,\n schemaPath: string,\n path: string,\n required: boolean,\n): DocumentField {\n const presentation = fieldPresentation(schema, schemaPath, path, required)\n\n switch (schema.type) {\n case 'boolean':\n return { ...presentation, input: input(schema, schemaPath, 'toggle', ['toggle']), type: 'boolean' }\n case 'integer':\n case 'number': {\n const options = numericOptions(schema.enum, schemaPath)\n\n return {\n ...presentation,\n input: input(schema, schemaPath, options.length > 0 ? 'select' : 'number', ['number', 'select']),\n options,\n type: 'number',\n }\n }\n\n case 'string': {\n if (schema.format === 'date') {\n return { ...presentation, input: input(schema, schemaPath, 'date', ['date']), type: 'date' }\n }\n\n const options = stringOptions(schema.enum, schemaPath)\n\n return {\n ...presentation,\n input: input(schema, schemaPath, options.length > 0 ? 'select' : 'text', ['select', 'text', 'textarea']),\n options,\n type: 'string',\n }\n }\n\n case 'array': {\n const items = requireObject(schema.items, `${schemaPath}[]`)\n\n if (items.type !== 'string') throw invalid(schemaPath, 'Studio currently supports authoring arrays of strings.')\n\n return {\n ...presentation,\n input: input(schema, schemaPath, 'multiselect', ['multiselect']),\n options: stringOptions(items.enum, `${schemaPath}[]`),\n type: 'string[]',\n }\n }\n\n default:\n throw invalid(schemaPath, `Studio cannot generate an input for schema type \"${displayJson(schema.type)}\".`)\n }\n}\n\nfunction fieldPresentation(schema: Schema.JsonObject, schemaPath: string, path: string, required: boolean) {\n const defaultValue = schema.default\n const description = stringKeyword(schema, 'description', schemaPath)\n const title = stringKeyword(schema, 'title', schemaPath)\n\n return {\n ...(defaultValue === undefined ? undefined : { defaultValue }),\n ...(description === undefined ? undefined : { description }),\n label: title?.trim() || humanize(path),\n path,\n required,\n }\n}\n\nfunction input<const Supported extends ReadonlyArray<CmsFieldInput>>(\n schema: Schema.JsonObject,\n path: string,\n fallback: Supported[number],\n supported: Supported,\n): Supported[number] {\n const configured = schema[FIELD_INPUT_METADATA]\n\n if (configured === undefined) return fallback\n const decoded = Schema.decodeUnknownResult(Schema.Literals([...supported]))(configured)\n\n if (Result.isSuccess(decoded)) return decoded.success\n throw invalid(path, `Input \"${displayJson(configured)}\" is not compatible with this field.`)\n}\n\nfunction stringOptions(value: Schema.Json | undefined, path: string): ReadonlyArray<string> {\n if (value === undefined) return []\n const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.String))(value)\n\n if (Result.isFailure(decoded)) throw invalid(path, 'Field options must all be strings.')\n\n return decoded.success\n}\n\nfunction numericOptions(value: Schema.Json | undefined, path: string): ReadonlyArray<number> {\n if (value === undefined) return []\n const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.Finite))(value)\n\n if (Result.isFailure(decoded)) throw invalid(path, 'Field options must all be finite numbers.')\n\n return decoded.success\n}\n\nfunction objectKeyword(schema: Schema.JsonObject, keyword: string, path: string, optional = false): Schema.JsonObject {\n const value = schema[keyword]\n\n if (value === undefined && optional) return {}\n\n return requireObject(value, `${path}.${keyword}`)\n}\n\nfunction stringArrayKeyword(schema: Schema.JsonObject, keyword: string, path: string): ReadonlySet<string> {\n const value = schema[keyword]\n\n if (value === undefined) return new Set()\n const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.String))(value)\n\n if (Result.isFailure(decoded)) throw invalid(`${path}.${keyword}`, `Expected \"${keyword}\" to be an array of strings.`)\n\n return new Set(decoded.success)\n}\n\nfunction stringKeyword(schema: Schema.JsonObject, keyword: string, path: string): string | undefined {\n const value = schema[keyword]\n\n if (value === undefined) return undefined\n const decoded = Schema.decodeUnknownResult(Schema.String)(value)\n\n if (Result.isFailure(decoded)) throw invalid(`${path}.${keyword}`, `Expected \"${keyword}\" to be a string.`)\n\n return decoded.success\n}\n\nfunction requireObject(value: Schema.Json | undefined, path: string): Schema.JsonObject {\n if (!isJsonObject(value)) throw invalid(path, 'Studio requires an object input structure at this location.')\n\n return value\n}\n\nfunction humanize(path: string): string {\n const name = path.split('.').at(-1) ?? path\n\n const words = name\n .replace(/([a-z\\d])([A-Z])/gu, '$1 $2')\n .replace(/[-_]+/gu, ' ')\n .trim()\n\n return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : name\n}\n\nfunction displayJson(value: Schema.Json | undefined): string {\n return value === undefined ? 'undefined' : (JSON.stringify(value) ?? 'undefined')\n}\n\nfunction invalid(path: string, message: string): CmsDocumentModelInvalid {\n return new CmsDocumentModelInvalid({ message, path })\n}\n\n/** Resolve local input references while rejecting recursive or ambiguous editor structures. */\nfunction resolveInputStructure(root: Schema.JsonObject, path: string): Schema.JsonObject {\n function visit(node: Schema.JsonObject, currentPath: string, ancestors: ReadonlySet<string>): Schema.JsonObject {\n if (node.$ref !== undefined) {\n const decodedRef = Schema.decodeUnknownResult(Schema.String)(node.$ref)\n\n if (Result.isFailure(decodedRef)) throw invalid(currentPath, 'Expected a string schema reference.')\n const ref = decodedRef.success\n\n if (!ref.startsWith('#/') || ancestors.has(ref)) {\n throw invalid(currentPath, 'Studio requires non-recursive local schema references.')\n }\n\n let target: Schema.Json | undefined = root\n\n for (const segment of ref.slice(2).split('/')) {\n target = isJsonObject(target) ? target[segment.replace(/~1/gu, '/').replace(/~0/gu, '~')] : undefined\n }\n\n const { $ref: _, ...siblings } = node\n\n return visit(\n Object.assign({}, requireObject(target, currentPath), siblings),\n currentPath,\n new Set([...ancestors, ref]),\n )\n }\n\n if (node.anyOf !== undefined || node.oneOf !== undefined) {\n throw invalid(currentPath, 'Studio requires a single supported input type per field.')\n }\n\n const out = Object.fromEntries(Object.entries(node))\n\n if (node.allOf !== undefined) {\n if (!Array.isArray(node.allOf)) throw invalid(currentPath, 'Expected an array of schema constraints.')\n\n for (const constraint of node.allOf) {\n const part = visit(requireObject(constraint, currentPath), currentPath, ancestors)\n\n if (\n part.properties !== undefined ||\n part.items !== undefined ||\n (part.type !== undefined && part.type !== node.type)\n ) {\n throw invalid(currentPath, 'Studio cannot combine structural schema intersections.')\n }\n\n for (const key of ['title', 'description', 'default', 'format', 'enum', FIELD_INPUT_METADATA]) {\n if (part[key] === undefined) continue\n\n if (out[key] !== undefined && JSON.stringify(out[key]) !== JSON.stringify(part[key])) {\n throw invalid(currentPath, `Conflicting field metadata \"${key}\" in schema intersection.`)\n }\n\n out[key] = part[key]\n }\n }\n }\n\n if (node.properties !== undefined) {\n out.properties = Object.fromEntries(\n Object.entries(requireObject(node.properties, currentPath)).map(([name, value]) => [\n name,\n visit(requireObject(value, `${currentPath}.${name}`), `${currentPath}.${name}`, ancestors),\n ]),\n )\n }\n\n if (node.items !== undefined)\n out.items = visit(requireObject(node.items, `${currentPath}[]`), `${currentPath}[]`, ancestors)\n\n return out\n }\n\n return visit(root, path, new Set())\n}\n\nfunction isEffectCollectionSchema(schema: CmsCollectionSchema): schema is Schema.ConstraintDecoder<unknown> {\n return Schema.isSchema(schema)\n}\n"],"mappings":";;;;;;AAsBA,MAAM,eAAe,OAAO,GAAG,OAAO,UAAU;AAchD,IAAa,0BAAb,cAA6C,OAAO,YAAqC,CAAC,CAAC,4BAA4B;CACrH,SAAS,OAAO;CAChB,MAAM,OAAO;AACf,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,4BAA4B,OAAO,GAAG,uBAAuB;AAEnE,SAAgB,wBAAwB,WAAoC,MAAyC;CACnH,IAAI;EACF,MAAM,WAAW,OAAO,QAAQ,UAAU,WAAW,CAAC,CAAC,KAAK,CAAC,YAAY,aACvE,kBAAkB,YAAY,OAAO,CACvC;EAEA,MAAM,UAAU,OAAO,aAAa,qBAAqB,CAAC,CAAC;GACzD,GAAI,SAAS,SACT,SACA,EACE,SAAS;IACP,eAAe,KAAK;IACpB,gBAAgB,KAAK,kBAAkB;IACvC,SAAS,OAAO,KAAK,KAAK,OAAO;IACjC,qBAAqB,KAAK,uBAAuB;GACnD,EACF;GACJ,OAAO,SAAS,KAAK,UAAU,MAAM,SAAS;EAChD,CAAC;EAED,IAAI,OAAO,UAAU,OAAO,GAAG,MAAM,QAAQ,aAAa,OAAO,QAAQ,OAAO,CAAC;EAEjF,MAAM,QA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AAC,KAAK,CAAC,MAAM,WAAW,CACjF,MACA,MAAM,cAAc,OAAO,GAAG,YAAY,GAAG,MAAM,GAAG,GAAG,YAAY,GAAG,QAAQ,SAAS,CAC3F,CAAC,CACH;EAGF,IAAI,KAAK,UAAU,QACjB,IAAI,QAAQ,MAAM,cAAc,KAAK,OAAO,GAAG,YAAY,GAAG,GAAG,GAAG,YAAY,KAAK,SAAS;EAEhG,OAAO;CACT;CAEA,OAAO,MAAM,MAAM,sBAAM,IAAI,IAAI,CAAC;AACpC;AAEA,SAAS,yBAAyB,QAA0E;CAC1G,OAAO,OAAO,SAAS,MAAM;AAC/B"}
1
+ {"version":3,"file":"document-model.js","names":[],"sources":["../../../../src/internal/document-model.ts"],"sourcesContent":["import type { CmsI18nOptions } from '../I18n'\nimport type { StandardJSONSchemaV1 } from 'effect/StandardSchema'\nimport type {\n DocumentSchemaProjection,\n ExecutableDocumentModel,\n ExecutableDocumentSchema,\n} from '@internal/document/DocumentEngine'\nimport type {\n DocumentConfiguration as DocumentConfigurationType,\n DocumentField,\n} from '@internal/protocol/Configuration'\nimport type {\n CmsCollectionOptions,\n CmsCollectionSchema,\n CmsDocumentModelOptions,\n CmsFieldInput,\n} from '../DocumentModel'\nimport { createDocumentEngine } from '@internal/document/DocumentEngine'\nimport { DocumentConfiguration } from '@internal/protocol/Configuration'\nimport { Effect, Predicate, Result, Schema } from 'effect'\nimport { FIELD_INPUT_METADATA } from './field-metadata'\n\nconst isJsonObject = Schema.is(Schema.JsonObject)\n\ntype EncodedDocumentConfiguration = Schema.Codec.Encoded<typeof DocumentConfiguration>\n\ninterface CmsDocumentModel {\n readonly authoring: DocumentConfigurationType\n readonly executable: ExecutableDocumentModel\n}\n\ninterface CompiledCollection {\n readonly authoring: EncodedDocumentConfiguration['types'][number]\n readonly executable: ExecutableDocumentSchema\n}\n\nexport class CmsDocumentModelInvalid extends Schema.TaggedError<CmsDocumentModelInvalid>()('Cms.DocumentModelInvalid', {\n message: Schema.NonEmptyString,\n path: Schema.NonEmptyString,\n}) {}\n\nconst isCmsDocumentModelInvalid = Schema.is(CmsDocumentModelInvalid)\n\nexport function compileCmsDocumentModel(documents: CmsDocumentModelOptions, i18n?: CmsI18nOptions): CmsDocumentModel {\n try {\n const compiled = Object.entries(documents.collections).map(([collection, options]) =>\n compileCollection(collection, options),\n )\n\n const decoded = Schema.decodeResult(DocumentConfiguration)({\n ...(i18n === undefined\n ? undefined\n : {\n locales: {\n defaultLocale: i18n.defaultLocale,\n fallbackLocale: i18n.fallbackLocale ?? null,\n locales: Object.keys(i18n.locales),\n prefixDefaultLocale: i18n.prefixDefaultLocale ?? false,\n },\n }),\n types: compiled.map((entry) => entry.authoring),\n })\n\n if (Result.isFailure(decoded)) throw invalid('documents', String(decoded.failure))\n\n const model = {\n authoring: decoded.success,\n executable: {\n types: Object.fromEntries(compiled.map((entry) => [entry.authoring.collection, entry.executable])),\n },\n }\n\n const engine = Effect.runSync(\n Effect.result(createDocumentEngine(model.authoring, { documentModel: model.executable })),\n )\n\n if (Result.isFailure(engine)) throw invalid('documents', engine.failure.message)\n\n return model\n } catch (cause) {\n throw isCmsDocumentModelInvalid(cause)\n ? cause\n : invalid('documents.collections', cause instanceof Error ? cause.message : String(cause))\n }\n}\n\nfunction compileCollection(collection: string, options: CmsCollectionOptions): CompiledCollection {\n const path = `documents.collections.${collection}`\n let generated: ReturnType<StandardJSONSchemaV1.Converter['input']>\n\n try {\n if (isEffectCollectionSchema(options.schema)) {\n const document = Schema.toJsonSchemaDocument(options.schema, {\n includeAnnotationKey: (key) => key === FIELD_INPUT_METADATA,\n referencePolicy: () => undefined,\n })\n\n generated = { ...document.schema, $defs: document.definitions }\n } else {\n if (!Predicate.isFunction(options.schema['~standard']?.jsonSchema?.input)) {\n throw new Error('Studio needs Standard JSON Schema V1 input conversion (or an adapter that supplies it).')\n }\n\n generated = options.schema['~standard'].jsonSchema.input({ target: 'draft-2020-12' })\n }\n } catch (cause) {\n throw invalid(`${path}.schema`, cause instanceof Error ? cause.message : String(cause))\n }\n\n const decoded = Schema.decodeUnknownResult(Schema.JsonObject)(generated)\n\n if (Result.isFailure(decoded)) throw invalid(`${path}.schema`, 'The generated input structure is not serializable.')\n const input = resolveInputStructure(decoded.success, `${path}.schema`)\n\n if (input.type !== 'object') throw invalid(`${path}.schema`, 'A collection schema must describe an object input.')\n const projection = compileProjection(input, `${path}.schema`)\n\n const validator = isEffectCollectionSchema(options.schema)\n ? Schema.toStandardSchemaV1(options.schema)\n : options.schema\n\n return {\n authoring: {\n addressPattern: options.route,\n ...(options.body === undefined ? undefined : { body: options.body }),\n authoringFields: compileAuthoringFields(input, `${path}.schema`),\n canCreate: options.canCreate ?? true,\n collection,\n description: options.description ?? '',\n directory: options.source ?? collection,\n hierarchy: options.hierarchy ?? options.route.includes('*'),\n label: options.label,\n },\n executable: {\n project: projection,\n validate: (value) => Effect.tryPromise(() => Promise.resolve(validator['~standard'].validate(value))),\n },\n }\n}\n\ntype ProjectDocumentProjection = (input: Schema.JsonObject) => DocumentSchemaProjection\n\nfunction compileProjection(schema: Schema.JsonObject, path: string, parent = ''): ProjectDocumentProjection {\n const properties = objectKeyword(schema, 'properties', path, true)\n\n const declarations = new Map(\n Object.entries(properties).map(([name, value]) => {\n const fieldPath = parent ? `${parent}.${name}` : name\n const property = requireObject(value, `${path}.${name}`)\n const nested = property.type === 'object' ? compileProjection(property, `${path}.${name}`, fieldPath) : undefined\n\n return [name, nested] as const\n }),\n )\n\n return (input) => {\n const value: Record<string, Schema.Json> = {}\n const unknownPaths: string[] = []\n\n for (const [name, child] of Object.entries(input)) {\n const nested = declarations.get(name)\n\n if (!declarations.has(name)) {\n unknownPaths.push(parent ? `${parent}.${name}` : name)\n } else if (nested && isJsonObject(child)) {\n const projected = nested(child)\n value[name] = projected.value\n unknownPaths.push(...projected.unknownPaths)\n } else {\n value[name] = child\n }\n }\n\n return { unknownPaths, value }\n }\n}\n\nfunction compileAuthoringFields(\n schema: Schema.JsonObject,\n path: string,\n parent = '',\n parentRequired = true,\n): ReadonlyArray<DocumentField> {\n const properties = objectKeyword(schema, 'properties', path, true)\n const required = stringArrayKeyword(schema, 'required', path)\n\n return Object.entries(properties).flatMap(([name, value]) => {\n if (!name || name.includes('.')) {\n throw invalid(`${path}.${name || '<empty>'}`, 'Field names must be non-empty and cannot contain dots.')\n }\n\n const fieldPath = parent ? `${parent}.${name}` : name\n\n if (fieldPath === 'id') throw invalid(`${path}.id`, 'Field \"id\" is reserved for CMS identity.')\n const property = requireObject(value, `${path}.${name}`)\n const fieldRequired = parentRequired && required.has(name)\n\n if (property.type === 'object') {\n if (property.default !== undefined) {\n throw invalid(\n `${path}.${name}`,\n 'Defaults on object fields are not supported; default their leaf fields instead.',\n )\n }\n\n return compileAuthoringFields(property, `${path}.${name}`, fieldPath, fieldRequired)\n }\n\n return [compileAuthoringField(property, `${path}.${name}`, fieldPath, fieldRequired)]\n })\n}\n\nfunction compileAuthoringField(\n schema: Schema.JsonObject,\n schemaPath: string,\n path: string,\n required: boolean,\n): DocumentField {\n const presentation = fieldPresentation(schema, schemaPath, path, required)\n\n switch (schema.type) {\n case 'boolean':\n return { ...presentation, input: input(schema, schemaPath, 'toggle', ['toggle']), type: 'boolean' }\n case 'integer':\n case 'number': {\n const options = numericOptions(schema.enum, schemaPath)\n\n return {\n ...presentation,\n input: input(schema, schemaPath, options.length > 0 ? 'select' : 'number', ['number', 'select']),\n options,\n type: 'number',\n }\n }\n\n case 'string': {\n if (schema.format === 'date') {\n return { ...presentation, input: input(schema, schemaPath, 'date', ['date']), type: 'date' }\n }\n\n const options = stringOptions(schema.enum, schemaPath)\n\n return {\n ...presentation,\n input: input(schema, schemaPath, options.length > 0 ? 'select' : 'text', ['select', 'text', 'textarea']),\n options,\n type: 'string',\n }\n }\n\n case 'array': {\n const items = requireObject(schema.items, `${schemaPath}[]`)\n\n if (items.type !== 'string') throw invalid(schemaPath, 'Studio currently supports authoring arrays of strings.')\n\n return {\n ...presentation,\n input: input(schema, schemaPath, 'multiselect', ['multiselect']),\n options: stringOptions(items.enum, `${schemaPath}[]`),\n type: 'string[]',\n }\n }\n\n default:\n throw invalid(schemaPath, `Studio cannot generate an input for schema type \"${displayJson(schema.type)}\".`)\n }\n}\n\nfunction fieldPresentation(schema: Schema.JsonObject, schemaPath: string, path: string, required: boolean) {\n const defaultValue = schema.default\n const description = stringKeyword(schema, 'description', schemaPath)\n const title = stringKeyword(schema, 'title', schemaPath)\n\n return {\n ...(defaultValue === undefined ? undefined : { defaultValue }),\n ...(description === undefined ? undefined : { description }),\n label: title?.trim() || humanize(path),\n path,\n required,\n }\n}\n\nfunction input<const Supported extends ReadonlyArray<CmsFieldInput>>(\n schema: Schema.JsonObject,\n path: string,\n fallback: Supported[number],\n supported: Supported,\n): Supported[number] {\n const configured = schema[FIELD_INPUT_METADATA]\n\n if (configured === undefined) return fallback\n const decoded = Schema.decodeUnknownResult(Schema.Literals([...supported]))(configured)\n\n if (Result.isSuccess(decoded)) return decoded.success\n throw invalid(path, `Input \"${displayJson(configured)}\" is not compatible with this field.`)\n}\n\nfunction stringOptions(value: Schema.Json | undefined, path: string): ReadonlyArray<string> {\n if (value === undefined) return []\n const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.String))(value)\n\n if (Result.isFailure(decoded)) throw invalid(path, 'Field options must all be strings.')\n\n return decoded.success\n}\n\nfunction numericOptions(value: Schema.Json | undefined, path: string): ReadonlyArray<number> {\n if (value === undefined) return []\n const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.Finite))(value)\n\n if (Result.isFailure(decoded)) throw invalid(path, 'Field options must all be finite numbers.')\n\n return decoded.success\n}\n\nfunction objectKeyword(schema: Schema.JsonObject, keyword: string, path: string, optional = false): Schema.JsonObject {\n const value = schema[keyword]\n\n if (value === undefined && optional) return {}\n\n return requireObject(value, `${path}.${keyword}`)\n}\n\nfunction stringArrayKeyword(schema: Schema.JsonObject, keyword: string, path: string): ReadonlySet<string> {\n const value = schema[keyword]\n\n if (value === undefined) return new Set()\n const decoded = Schema.decodeUnknownResult(Schema.Array(Schema.String))(value)\n\n if (Result.isFailure(decoded)) throw invalid(`${path}.${keyword}`, `Expected \"${keyword}\" to be an array of strings.`)\n\n return new Set(decoded.success)\n}\n\nfunction stringKeyword(schema: Schema.JsonObject, keyword: string, path: string): string | undefined {\n const value = schema[keyword]\n\n if (value === undefined) return undefined\n const decoded = Schema.decodeUnknownResult(Schema.String)(value)\n\n if (Result.isFailure(decoded)) throw invalid(`${path}.${keyword}`, `Expected \"${keyword}\" to be a string.`)\n\n return decoded.success\n}\n\nfunction requireObject(value: Schema.Json | undefined, path: string): Schema.JsonObject {\n if (!isJsonObject(value)) throw invalid(path, 'Studio requires an object input structure at this location.')\n\n return value\n}\n\nfunction humanize(path: string): string {\n const name = path.split('.').at(-1) ?? path\n\n const words = name\n .replace(/([a-z\\d])([A-Z])/gu, '$1 $2')\n .replace(/[-_]+/gu, ' ')\n .trim()\n\n return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : name\n}\n\nfunction displayJson(value: Schema.Json | undefined): string {\n return value === undefined ? 'undefined' : (JSON.stringify(value) ?? 'undefined')\n}\n\nfunction invalid(path: string, message: string): CmsDocumentModelInvalid {\n return new CmsDocumentModelInvalid({ message, path })\n}\n\n/** Resolve local input references while rejecting recursive or ambiguous editor structures. */\nfunction resolveInputStructure(root: Schema.JsonObject, path: string): Schema.JsonObject {\n function visit(node: Schema.JsonObject, currentPath: string, ancestors: ReadonlySet<string>): Schema.JsonObject {\n if (node.$ref !== undefined) {\n const decodedRef = Schema.decodeUnknownResult(Schema.String)(node.$ref)\n\n if (Result.isFailure(decodedRef)) throw invalid(currentPath, 'Expected a string schema reference.')\n const ref = decodedRef.success\n\n if (!ref.startsWith('#/') || ancestors.has(ref)) {\n throw invalid(currentPath, 'Studio requires non-recursive local schema references.')\n }\n\n let target: Schema.Json | undefined = root\n\n for (const segment of ref.slice(2).split('/')) {\n target = isJsonObject(target) ? target[segment.replace(/~1/gu, '/').replace(/~0/gu, '~')] : undefined\n }\n\n const { $ref: _, ...siblings } = node\n\n return visit(\n Object.assign({}, requireObject(target, currentPath), siblings),\n currentPath,\n new Set([...ancestors, ref]),\n )\n }\n\n if (node.anyOf !== undefined || node.oneOf !== undefined) {\n throw invalid(currentPath, 'Studio requires a single supported input type per field.')\n }\n\n const out = Object.fromEntries(Object.entries(node))\n\n if (node.allOf !== undefined) {\n if (!Array.isArray(node.allOf)) throw invalid(currentPath, 'Expected an array of schema constraints.')\n\n for (const constraint of node.allOf) {\n const part = visit(requireObject(constraint, currentPath), currentPath, ancestors)\n\n if (\n part.properties !== undefined ||\n part.items !== undefined ||\n (part.type !== undefined && part.type !== node.type)\n ) {\n throw invalid(currentPath, 'Studio cannot combine structural schema intersections.')\n }\n\n for (const key of ['title', 'description', 'default', 'format', 'enum', FIELD_INPUT_METADATA]) {\n if (part[key] === undefined) continue\n\n if (out[key] !== undefined && JSON.stringify(out[key]) !== JSON.stringify(part[key])) {\n throw invalid(currentPath, `Conflicting field metadata \"${key}\" in schema intersection.`)\n }\n\n out[key] = part[key]\n }\n }\n }\n\n if (node.properties !== undefined) {\n out.properties = Object.fromEntries(\n Object.entries(requireObject(node.properties, currentPath)).map(([name, value]) => [\n name,\n visit(requireObject(value, `${currentPath}.${name}`), `${currentPath}.${name}`, ancestors),\n ]),\n )\n }\n\n if (node.items !== undefined)\n out.items = visit(requireObject(node.items, `${currentPath}[]`), `${currentPath}[]`, ancestors)\n\n return out\n }\n\n return visit(root, path, new Set())\n}\n\nfunction isEffectCollectionSchema(schema: CmsCollectionSchema): schema is Schema.ConstraintDecoder<unknown> {\n return Schema.isSchema(schema)\n}\n"],"mappings":";;;;;;AAsBA,MAAM,eAAe,OAAO,GAAG,OAAO,UAAU;AAchD,IAAa,0BAAb,cAA6C,OAAO,YAAqC,CAAC,CAAC,4BAA4B;CACrH,SAAS,OAAO;CAChB,MAAM,OAAO;AACf,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,4BAA4B,O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AAK,KAAK,GAAG,MAAM,QAAQ,aAAa,0CAA0C;GAErG,KAAK,MAAM,cAAc,KAAK,OAAO;IACnC,MAAM,OAAO,MAAM,cAAc,YAAY,WAAW,GAAG,aAAa,SAAS;IAEjF,IACE,KAAK,eAAe,UACpB,KAAK,UAAU,UACd,KAAK,SAAS,UAAa,KAAK,SAAS,KAAK,MAE/C,MAAM,QAAQ,aAAa,wDAAwD;IAGrF,KAAK,MAAM,OAAO;KAAC;KAAS;KAAe;KAAW;KAAU;KAAQ;IAAoB,GAAG;KAC7F,IAAI,KAAK,SAAS,QAAW;KAE7B,IAAI,IAAI,SAAS,UAAa,KAAK,UAAU,IAAI,IAAI,MAAM,KAAK,UAAU,KAAK,IAAI,GACjF,MAAM,QAAQ,aAAa,+BAA+B,IAAI,0BAA0B;KAG1F,IAAI,OAAO,KAAK;IAClB;GACF;EACF;EAEA,IAAI,KAAK,eAAe,QACtB,IAAI,aAAa,OAAO,YACtB,OAAO,QAAQ,cAAc,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,WAAW,CACjF,MACA,MAAM,cAAc,OAAO,GAAG,YAAY,GAAG,MAAM,GAAG,GAAG,YAAY,GAAG,QAAQ,SAAS,CAC3F,CAAC,CACH;EAGF,IAAI,KAAK,UAAU,QACjB,IAAI,QAAQ,MAAM,cAAc,KAAK,OAAO,GAAG,YAAY,GAAG,GAAG,GAAG,YAAY,KAAK,SAAS;EAEhG,OAAO;CACT;CAEA,OAAO,MAAM,MAAM,sBAAM,IAAI,IAAI,CAAC;AACpC;AAEA,SAAS,yBAAyB,QAA0E;CAC1G,OAAO,OAAO,SAAS,MAAM;AAC/B"}
@@ -1,4 +1,4 @@
1
- import { a as PreviewSessionId, i as PreviewOrigin } from "./models-BWm1pTAf.js";
1
+ import { a as PreviewSessionId, i as PreviewOrigin } from "./models-B4IoTmp7.js";
2
2
  import { Option, Schema } from "effect";
3
3
 
4
4
  //#region ../protocol/src/internal/preview/location.ts
@@ -32,4 +32,4 @@ function previewRedirect(url, parameters) {
32
32
 
33
33
  //#endregion
34
34
  export { readPreviewLocation as n, withPreviewLocation as r, previewRedirect as t };
35
- //# sourceMappingURL=location-CFKTeK1K.js.map
35
+ //# sourceMappingURL=location-BTqdfIzX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"location-CFKTeK1K.js","names":["PreviewOriginSchema","PreviewSessionIdSchema"],"sources":["../../../../protocol/src/internal/preview/location.ts"],"sourcesContent":["import { Option, Schema } from 'effect'\nimport { PreviewOrigin as PreviewOriginSchema, PreviewSessionId as PreviewSessionIdSchema } from './models'\n\nconst ENABLED_PARAMETER = '_cms_preview'\n\nconst EDITOR_ORIGIN_PARAMETER = '_cms_preview_editor_origin'\n\nconst SESSION_PARAMETER = '_cms_preview_session'\n\nconst PreviewLocationParameters = Schema.Struct({\n editorOrigin: PreviewOriginSchema,\n sessionId: PreviewSessionIdSchema,\n})\n\nexport interface PreviewLocationParameters extends Schema.Schema.Type<typeof PreviewLocationParameters> {}\n\nexport function readPreviewLocation(url: URL): PreviewLocationParameters | undefined {\n if (url.searchParams.get(ENABLED_PARAMETER) !== '1' || url.searchParams.get(EDITOR_ORIGIN_PARAMETER) !== url.origin)\n return undefined\n\n return Schema.decodeUnknownOption(PreviewLocationParameters)({\n editorOrigin: url.searchParams.get(EDITOR_ORIGIN_PARAMETER),\n sessionId: url.searchParams.get(SESSION_PARAMETER),\n }).pipe(Option.getOrUndefined)\n}\n\nexport function withPreviewLocation(url: URL, parameters: PreviewLocationParameters): URL {\n const next = new URL(url)\n next.searchParams.set(ENABLED_PARAMETER, '1')\n next.searchParams.set(EDITOR_ORIGIN_PARAMETER, parameters.editorOrigin)\n next.searchParams.set(SESSION_PARAMETER, parameters.sessionId)\n\n return next\n}\n\nexport function withoutPreviewLocation(url: URL): URL {\n const next = new URL(url)\n next.searchParams.delete(ENABLED_PARAMETER)\n next.searchParams.delete(EDITOR_ORIGIN_PARAMETER)\n next.searchParams.delete(SESSION_PARAMETER)\n\n return next\n}\n\nexport function previewRedirect(url: URL, parameters: PreviewLocationParameters): string | undefined {\n const current = readPreviewLocation(url)\n\n if (current?.sessionId === parameters.sessionId && current.editorOrigin === parameters.editorOrigin) return undefined\n const next = withPreviewLocation(url, parameters)\n\n return `${next.pathname}${next.search}${next.hash}`\n}\n"],"mappings":";;;;AAGA,MAAM,oBAAoB;AAE1B,MAAM,0BAA0B;AAEhC,MAAM,oBAAoB;AAE1B,MAAM,4BAA4B,OAAO,OAAO;CAC9C,cAAcA;CACd,WAAWC;AACb,CAAC;AAID,SAAgB,oBAAoB,KAAiD;CACnF,IAAI,IAAI,aAAa,IAAI,iBAAiB,MAAM,OAAO,IAAI,aAAa,IAAI,uBAAuB,MAAM,IAAI,QAC3G,OAAO;CAET,OAAO,OAAO,oBAAoB,yBAAyB,CAAC,CAAC;EAC3D,cAAc,IAAI,aAAa,IAAI,uBAAuB;EAC1D,WAAW,IAAI,aAAa,IAAI,iBAAiB;CACnD,CAAC,CAAC,CAAC,KAAK,OAAO,cAAc;AAC/B;AAEA,SAAgB,oBAAoB,KAAU,YAA4C;CACxF,MAAM,OAAO,IAAI,IAAI,GAAG;CACxB,KAAK,aAAa,IAAI,mBAAmB,GAAG;CAC5C,KAAK,aAAa,IAAI,yBAAyB,WAAW,YAAY;CACtE,KAAK,aAAa,IAAI,mBAAmB,WAAW,SAAS;CAE7D,OAAO;AACT;AAWA,SAAgB,gBAAgB,KAAU,YAA2D;CACnG,MAAM,UAAU,oBAAoB,GAAG;CAEvC,IAAI,SAAS,cAAc,WAAW,aAAa,QAAQ,iBAAiB,WAAW,cAAc,OAAO;CAC5G,MAAM,OAAO,oBAAoB,KAAK,UAAU;CAEhD,OAAO,GAAG,KAAK,WAAW,KAAK,SAAS,KAAK;AAC/C"}
1
+ {"version":3,"file":"location-BTqdfIzX.js","names":["PreviewOriginSchema","PreviewSessionIdSchema"],"sources":["../../../../protocol/src/internal/preview/location.ts"],"sourcesContent":["import { Option, Schema } from 'effect'\nimport { PreviewOrigin as PreviewOriginSchema, PreviewSessionId as PreviewSessionIdSchema } from './models'\n\nconst ENABLED_PARAMETER = '_cms_preview'\n\nconst EDITOR_ORIGIN_PARAMETER = '_cms_preview_editor_origin'\n\nconst SESSION_PARAMETER = '_cms_preview_session'\n\nconst PreviewLocationParameters = Schema.Struct({\n editorOrigin: PreviewOriginSchema,\n sessionId: PreviewSessionIdSchema,\n})\n\nexport interface PreviewLocationParameters extends Schema.Schema.Type<typeof PreviewLocationParameters> {}\n\nexport function readPreviewLocation(url: URL): PreviewLocationParameters | undefined {\n if (url.searchParams.get(ENABLED_PARAMETER) !== '1' || url.searchParams.get(EDITOR_ORIGIN_PARAMETER) !== url.origin)\n return undefined\n\n return Schema.decodeUnknownOption(PreviewLocationParameters)({\n editorOrigin: url.searchParams.get(EDITOR_ORIGIN_PARAMETER),\n sessionId: url.searchParams.get(SESSION_PARAMETER),\n }).pipe(Option.getOrUndefined)\n}\n\nexport function withPreviewLocation(url: URL, parameters: PreviewLocationParameters): URL {\n const next = new URL(url)\n next.searchParams.set(ENABLED_PARAMETER, '1')\n next.searchParams.set(EDITOR_ORIGIN_PARAMETER, parameters.editorOrigin)\n next.searchParams.set(SESSION_PARAMETER, parameters.sessionId)\n\n return next\n}\n\nexport function withoutPreviewLocation(url: URL): URL {\n const next = new URL(url)\n next.searchParams.delete(ENABLED_PARAMETER)\n next.searchParams.delete(EDITOR_ORIGIN_PARAMETER)\n next.searchParams.delete(SESSION_PARAMETER)\n\n return next\n}\n\nexport function previewRedirect(url: URL, parameters: PreviewLocationParameters): string | undefined {\n const current = readPreviewLocation(url)\n\n if (current?.sessionId === parameters.sessionId && current.editorOrigin === parameters.editorOrigin) return undefined\n const next = withPreviewLocation(url, parameters)\n\n return `${next.pathname}${next.search}${next.hash}`\n}\n"],"mappings":";;;;AAGA,MAAM,oBAAoB;AAE1B,MAAM,0BAA0B;AAEhC,MAAM,oBAAoB;AAE1B,MAAM,4BAA4B,OAAO,OAAO;CAC9C,cAAcA;CACd,WAAWC;AACb,CAAC;AAID,SAAgB,oBAAoB,KAAiD;CACnF,IAAI,IAAI,aAAa,IAAI,iBAAiB,MAAM,OAAO,IAAI,aAAa,IAAI,uBAAuB,MAAM,IAAI,QAC3G,OAAO;CAET,OAAO,OAAO,oBAAoB,yBAAyB,CAAC,CAAC;EAC3D,cAAc,IAAI,aAAa,IAAI,uBAAuB;EAC1D,WAAW,IAAI,aAAa,IAAI,iBAAiB;CACnD,CAAC,CAAC,CAAC,KAAK,OAAO,cAAc;AAC/B;AAEA,SAAgB,oBAAoB,KAAU,YAA4C;CACxF,MAAM,OAAO,IAAI,IAAI,GAAG;CACxB,KAAK,aAAa,IAAI,mBAAmB,GAAG;CAC5C,KAAK,aAAa,IAAI,yBAAyB,WAAW,YAAY;CACtE,KAAK,aAAa,IAAI,mBAAmB,WAAW,SAAS;CAE7D,OAAO;AACT;AAWA,SAAgB,gBAAgB,KAAU,YAA2D;CACnG,MAAM,UAAU,oBAAoB,GAAG;CAEvC,IAAI,SAAS,cAAc,WAAW,aAAa,QAAQ,iBAAiB,WAAW,cAAc,OAAO;CAC5G,MAAM,OAAO,oBAAoB,KAAK,UAAU;CAEhD,OAAO,GAAG,KAAK,WAAW,KAAK,SAAS,KAAK;AAC/C"}
@@ -1,5 +1,5 @@
1
1
  import { a as EditorNodeId, l as RevisionNumber, o as PublicPath, r as DocumentId } from "./scalars-B2lgGUnj.js";
2
- import { Et as CollectionName, kt as RequestId, r as CompiledDocument } from "./models-DwYioyNV.js";
2
+ import { Ct as CollectionName, Et as RequestId, r as CompiledDocument } from "./models-Bah5B3bT.js";
3
3
  import { Schema } from "effect";
4
4
 
5
5
  //#region ../protocol/src/internal/preview/models.ts
@@ -128,4 +128,4 @@ const isDocumentPreviewMessage = Schema.is(DocumentPreviewMessage);
128
128
 
129
129
  //#endregion
130
130
  export { PreviewSessionId as a, PreviewOrigin as i, DocumentPreviewMessage as n, isDocumentPreviewMessage as o, PreviewIntentId as r, DOCUMENT_PREVIEW_CHANNEL as t };
131
- //# sourceMappingURL=models-BWm1pTAf.js.map
131
+ //# sourceMappingURL=models-B4IoTmp7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"models-BWm1pTAf.js","names":[],"sources":["../../../../protocol/src/internal/preview/models.ts"],"sourcesContent":["import { CompiledDocument } from '../../Documents'\nimport { RequestId } from '../../Identity'\nimport { CollectionName } from '../configuration/scalars'\nimport { DocumentId, EditorNodeId, PublicPath, RevisionNumber } from '../documents/scalars'\nimport { Schema } from 'effect'\n\nexport const DOCUMENT_PREVIEW_CHANNEL = 'cms:document-preview'\n\nexport const PreviewSessionId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('PreviewSessionId'))\n\nexport type PreviewSessionId = typeof PreviewSessionId.Type\n\nexport const PreviewIntentId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('PreviewIntentId'))\n\nexport type PreviewIntentId = typeof PreviewIntentId.Type\n\nconst exactOrigin = Schema.makeFilter<string>(\n (value) => {\n try {\n const url = new URL(value)\n\n return (url.protocol === 'http:' || url.protocol === 'https:') && url.origin === value\n } catch {\n return false\n }\n },\n { expected: 'an exact HTTP or HTTPS origin without a path' },\n)\n\nexport const PreviewOrigin = Schema.NonEmptyString.check(exactOrigin).pipe(Schema.brand('PreviewOrigin'))\n\nexport type PreviewOrigin = typeof PreviewOrigin.Type\n\nexport const DocumentPreviewFocusIntent = Schema.Struct({\n id: PreviewIntentId,\n documentId: DocumentId,\n nodeId: Schema.optionalKey(EditorNodeId),\n origin: Schema.Literals(['editor', 'preview']),\n reveal: Schema.Boolean,\n revision: RevisionNumber,\n})\n\nexport interface DocumentPreviewFocusIntent extends Schema.Schema.Type<typeof DocumentPreviewFocusIntent> {}\n\nexport const RenderedCompiledDocument = Schema.Struct({\n collection: CollectionName,\n documentId: DocumentId,\n path: PublicPath,\n role: Schema.Literals(['embedded', 'primary', 'related', 'summary']),\n title: Schema.NonEmptyString,\n})\n\nexport interface RenderedCompiledDocument extends Schema.Schema.Type<typeof RenderedCompiledDocument> {}\n\nexport const RenderedDocumentManifest = Schema.Struct({\n documents: Schema.Array(RenderedCompiledDocument),\n route: PublicPath,\n})\n\nexport interface RenderedDocumentManifest extends Schema.Schema.Type<typeof RenderedDocumentManifest> {}\n\nconst previewEnvelope = {\n channel: Schema.Literal(DOCUMENT_PREVIEW_CHANNEL),\n sessionId: PreviewSessionId,\n}\n\nconst StudioConnectMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:connect'),\n})\n\nconst StudioModeMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:mode'),\n mode: Schema.Literals(['browse', 'edit']),\n})\n\nconst StudioNavigateMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:navigate'),\n path: PublicPath,\n})\n\nconst StudioPatchMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:patch'),\n document: CompiledDocument,\n fallbacks: Schema.Record(Schema.String, Schema.String),\n focus: Schema.optionalKey(DocumentPreviewFocusIntent),\n revision: RevisionNumber,\n})\n\nconst StudioFocusMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:focus'),\n focus: DocumentPreviewFocusIntent,\n})\n\nconst PreviewReadyMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:ready'),\n path: PublicPath,\n})\n\nconst PreviewManifestMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:manifest'),\n manifest: RenderedDocumentManifest,\n revision: RevisionNumber,\n})\n\nconst PreviewActivateMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:activate'),\n documentId: DocumentId,\n field: Schema.optionalKey(Schema.NonEmptyString),\n nodeId: Schema.optionalKey(EditorNodeId),\n requestId: RequestId,\n revision: RevisionNumber,\n})\n\nconst PreviewAppliedMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:applied'),\n intentId: PreviewIntentId,\n nodeId: Schema.optionalKey(EditorNodeId),\n result: Schema.Literals(['exact', 'fallback', 'missing']),\n revision: RevisionNumber,\n})\n\nconst PreviewRenderedMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:rendered'),\n revision: RevisionNumber,\n})\n\nexport const DocumentPreviewMessage = Schema.Union([\n StudioConnectMessage,\n StudioModeMessage,\n StudioNavigateMessage,\n StudioPatchMessage,\n StudioFocusMessage,\n PreviewReadyMessage,\n Schema.Struct({ ...previewEnvelope, type: Schema.tag('preview:error'), message: Schema.NullOr(Schema.String) }),\n PreviewManifestMessage,\n PreviewActivateMessage,\n PreviewAppliedMessage,\n PreviewRenderedMessage,\n]).pipe(Schema.toTaggedUnion('type'))\n\nexport type DocumentPreviewMessage = typeof DocumentPreviewMessage.Type\n\nexport const isDocumentPreviewMessage = Schema.is(DocumentPreviewMessage)\n\ntype PreviewPayload<Message extends DocumentPreviewMessage> = Message extends DocumentPreviewMessage\n ? Omit<Message, 'channel' | 'sessionId'>\n : never\n\nexport type StudioPreviewPayload = PreviewPayload<\n Extract<DocumentPreviewMessage, { readonly type: `studio:${string}` }>\n>\n\nexport type PreviewSitePayload = PreviewPayload<Extract<DocumentPreviewMessage, { readonly type: `preview:${string}` }>>\n"],"mappings":";;;;;AAMA,MAAa,2BAA2B;AAExC,MAAa,mBAAmB,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAI1G,MAAa,kBAAkB,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAIxG,MAAM,cAAc,OAAO,YACxB,UAAU;CACT,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EAEzB,QAAQ,IAAI,aAAa,WAAW,IAAI,aAAa,aAAa,IAAI,WAAW;CACnF,QAAQ;EACN,OAAO;CACT;AACF,GACA,EAAE,UAAU,+CAA+C,CAC7D;AAEA,MAAa,gBAAgB,O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,eAAe;CAChC,MAAM;AACR,CAAC;AAED,MAAM,yBAAyB,OAAO,OAAO;CAC3C,GAAG;CACH,MAAM,OAAO,IAAI,kBAAkB;CACnC,UAAU;CACV,UAAU;AACZ,CAAC;AAED,MAAM,yBAAyB,OAAO,OAAO;CAC3C,GAAG;CACH,MAAM,OAAO,IAAI,kBAAkB;CACnC,YAAY;CACZ,OAAO,OAAO,YAAY,OAAO,cAAc;CAC/C,QAAQ,OAAO,YAAY,YAAY;CACvC,WAAW;CACX,UAAU;AACZ,CAAC;AAED,MAAM,wBAAwB,OAAO,OAAO;CAC1C,GAAG;CACH,MAAM,OAAO,IAAI,iBAAiB;CAClC,UAAU;CACV,QAAQ,OAAO,YAAY,YAAY;CACvC,QAAQ,OAAO,SAAS;EAAC;EAAS;EAAY;CAAS,CAAC;CACxD,UAAU;AACZ,CAAC;AAED,MAAM,yBAAyB,OAAO,OAAO;CAC3C,GAAG;CACH,MAAM,OAAO,IAAI,kBAAkB;CACnC,UAAU;AACZ,CAAC;AAED,MAAa,yBAAyB,OAAO,MAAM;CACjD;CACA;CACA;CACA;CACA;CACA;CACA,OAAO,OAAO;EAAE,GAAG;EAAiB,MAAM,OAAO,IAAI,eAAe;EAAG,SAAS,OAAO,OAAO,OAAO,MAAM;CAAE,CAAC;CAC9G;CACA;CACA;CACA;AACF,CAAC,CAAC,CAAC,KAAK,OAAO,cAAc,MAAM,CAAC;AAIpC,MAAa,2BAA2B,OAAO,GAAG,sBAAsB"}
1
+ {"version":3,"file":"models-B4IoTmp7.js","names":[],"sources":["../../../../protocol/src/internal/preview/models.ts"],"sourcesContent":["import { CompiledDocument } from '../../Documents'\nimport { RequestId } from '../../Identity'\nimport { CollectionName } from '../configuration/scalars'\nimport { DocumentId, EditorNodeId, PublicPath, RevisionNumber } from '../documents/scalars'\nimport { Schema } from 'effect'\n\nexport const DOCUMENT_PREVIEW_CHANNEL = 'cms:document-preview'\n\nexport const PreviewSessionId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('PreviewSessionId'))\n\nexport type PreviewSessionId = typeof PreviewSessionId.Type\n\nexport const PreviewIntentId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('PreviewIntentId'))\n\nexport type PreviewIntentId = typeof PreviewIntentId.Type\n\nconst exactOrigin = Schema.makeFilter<string>(\n (value) => {\n try {\n const url = new URL(value)\n\n return (url.protocol === 'http:' || url.protocol === 'https:') && url.origin === value\n } catch {\n return false\n }\n },\n { expected: 'an exact HTTP or HTTPS origin without a path' },\n)\n\nexport const PreviewOrigin = Schema.NonEmptyString.check(exactOrigin).pipe(Schema.brand('PreviewOrigin'))\n\nexport type PreviewOrigin = typeof PreviewOrigin.Type\n\nexport const DocumentPreviewFocusIntent = Schema.Struct({\n id: PreviewIntentId,\n documentId: DocumentId,\n nodeId: Schema.optionalKey(EditorNodeId),\n origin: Schema.Literals(['editor', 'preview']),\n reveal: Schema.Boolean,\n revision: RevisionNumber,\n})\n\nexport interface DocumentPreviewFocusIntent extends Schema.Schema.Type<typeof DocumentPreviewFocusIntent> {}\n\nexport const RenderedCompiledDocument = Schema.Struct({\n collection: CollectionName,\n documentId: DocumentId,\n path: PublicPath,\n role: Schema.Literals(['embedded', 'primary', 'related', 'summary']),\n title: Schema.NonEmptyString,\n})\n\nexport interface RenderedCompiledDocument extends Schema.Schema.Type<typeof RenderedCompiledDocument> {}\n\nexport const RenderedDocumentManifest = Schema.Struct({\n documents: Schema.Array(RenderedCompiledDocument),\n route: PublicPath,\n})\n\nexport interface RenderedDocumentManifest extends Schema.Schema.Type<typeof RenderedDocumentManifest> {}\n\nconst previewEnvelope = {\n channel: Schema.Literal(DOCUMENT_PREVIEW_CHANNEL),\n sessionId: PreviewSessionId,\n}\n\nconst StudioConnectMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:connect'),\n})\n\nconst StudioModeMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:mode'),\n mode: Schema.Literals(['browse', 'edit']),\n})\n\nconst StudioNavigateMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:navigate'),\n path: PublicPath,\n})\n\nconst StudioPatchMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:patch'),\n document: CompiledDocument,\n fallbacks: Schema.Record(Schema.String, Schema.String),\n focus: Schema.optionalKey(DocumentPreviewFocusIntent),\n revision: RevisionNumber,\n})\n\nconst StudioFocusMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:focus'),\n focus: DocumentPreviewFocusIntent,\n})\n\nconst PreviewReadyMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:ready'),\n path: PublicPath,\n})\n\nconst PreviewManifestMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:manifest'),\n manifest: RenderedDocumentManifest,\n revision: RevisionNumber,\n})\n\nconst PreviewActivateMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:activate'),\n documentId: DocumentId,\n field: Schema.optionalKey(Schema.NonEmptyString),\n nodeId: Schema.optionalKey(EditorNodeId),\n requestId: RequestId,\n revision: RevisionNumber,\n})\n\nconst PreviewAppliedMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:applied'),\n intentId: PreviewIntentId,\n nodeId: Schema.optionalKey(EditorNodeId),\n result: Schema.Literals(['exact', 'fallback', 'missing']),\n revision: RevisionNumber,\n})\n\nconst PreviewRenderedMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:rendered'),\n revision: RevisionNumber,\n})\n\nexport const DocumentPreviewMessage = Schema.Union([\n StudioConnectMessage,\n StudioModeMessage,\n StudioNavigateMessage,\n StudioPatchMessage,\n StudioFocusMessage,\n PreviewReadyMessage,\n Schema.Struct({ ...previewEnvelope, type: Schema.tag('preview:error'), message: Schema.NullOr(Schema.String) }),\n PreviewManifestMessage,\n PreviewActivateMessage,\n PreviewAppliedMessage,\n PreviewRenderedMessage,\n]).pipe(Schema.toTaggedUnion('type'))\n\nexport type DocumentPreviewMessage = typeof DocumentPreviewMessage.Type\n\nexport const isDocumentPreviewMessage = Schema.is(DocumentPreviewMessage)\n\ntype PreviewPayload<Message extends DocumentPreviewMessage> = Message extends DocumentPreviewMessage\n ? Omit<Message, 'channel' | 'sessionId'>\n : never\n\nexport type StudioPreviewPayload = PreviewPayload<\n Extract<DocumentPreviewMessage, { readonly type: `studio:${string}` }>\n>\n\nexport type PreviewSitePayload = PreviewPayload<Extract<DocumentPreviewMessage, { readonly type: `preview:${string}` }>>\n"],"mappings":";;;;;AAMA,MAAa,2BAA2B;AAExC,MAAa,mBAAmB,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAI1G,MAAa,kBAAkB,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAIxG,MAAM,cAAc,OAAO,YACxB,UAAU;CACT,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EAEzB,QAAQ,IAAI,aAAa,WAAW,IAAI,aAAa,aAAa,IAAI,WAAW;CACnF,QAAQ;EACN,OAAO;CACT;AACF,GACA,EAAE,UAAU,+CAA+C,CAC7D;AAEA,MAAa,gBAAgB,OAAO,eAAe,MAAM,WAAW,CAAC,CAAC,KAAK,OAAO,MAAM,eAAe,CAAC;AAIxG,MAAa,6BAA6B,OAAO,OAAO;CACtD,IAAI;CACJ,YAAY;CACZ,QAAQ,OAAO,YAAY,YAAY;CACvC,QAAQ,OAAO,SAAS,CAAC,UAAU,SAAS,CAAC;CAC7C,QAAQ,OAAO;CACf,UAAU;AACZ,CAAC;AAID,MAAa,2BAA2B,OAAO,OAAO;CACpD,YAAY;CACZ,YAAY;CACZ,MAAM;CACN,MAAM,OAAO,SAAS;EAAC;EAAY;EAAW;EAAW;CAAS,CAAC;CACnE,OAAO,OAAO;AAChB,CAAC;AAID,MAAa,2BAA2B,OAAO,OA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,OAAO,YAAY,YAAY;CACvC,QAAQ,OAAO,SAAS;EAAC;EAAS;EAAY;CAAS,CAAC;CACxD,UAAU;AACZ,CAAC;AAED,MAAM,yBAAyB,OAAO,OAAO;CAC3C,GAAG;CACH,MAAM,OAAO,IAAI,kBAAkB;CACnC,UAAU;AACZ,CAAC;AAED,MAAa,yBAAyB,OAAO,MAAM;CACjD;CACA;CACA;CACA;CACA;CACA;CACA,OAAO,OAAO;EAAE,GAAG;EAAiB,MAAM,OAAO,IAAI,eAAe;EAAG,SAAS,OAAO,OAAO,OAAO,MAAM;CAAE,CAAC;CAC9G;CACA;CACA;CACA;AACF,CAAC,CAAC,CAAC,KAAK,OAAO,cAAc,MAAM,CAAC;AAIpC,MAAa,2BAA2B,OAAO,GAAG,sBAAsB"}
@@ -154,7 +154,8 @@ const DOCUMENT_ACTIONS = [
154
154
  "document.publish",
155
155
  "document.unpublish",
156
156
  "document.duplicate",
157
- "document.history"
157
+ "document.history",
158
+ "document.transfer"
158
159
  ];
159
160
  const DocumentAction = Schema.Literals(DOCUMENT_ACTIONS);
160
161
  const DocumentCatalogResource = Schema.Struct({ kind: Schema.tag("catalog") });
@@ -527,24 +528,6 @@ const DocumentSource = Schema.Struct({
527
528
  version: DocumentVersion,
528
529
  publishedVersion: Schema.optionalKey(DocumentVersion)
529
530
  }).annotate({ identifier: "DocumentSource" });
530
- const DocumentImportSource = Schema.Struct({
531
- sourcePath: SourcePath,
532
- markdown: Schema.String,
533
- published: Schema.Boolean
534
- }).annotate({ identifier: "DocumentImportSource" });
535
- const DocumentImportMode = Schema.Literals(["preserve", "overwrite"]);
536
- const DocumentImportInput = Schema.Struct({
537
- sources: Schema.Array(DocumentImportSource),
538
- mode: DocumentImportMode,
539
- reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1e3)))
540
- }).annotate({ identifier: "DocumentImportInput" });
541
- const DocumentImportReport = Schema.Struct({
542
- created: nonNegativeInt,
543
- preserved: nonNegativeInt,
544
- published: nonNegativeInt,
545
- unchanged: nonNegativeInt,
546
- updated: nonNegativeInt
547
- }).annotate({ identifier: "DocumentImportReport" });
548
531
  const DocumentSummary = Schema.Struct({
549
532
  ...documentAttribution,
550
533
  publishedVersion: Schema.optionalKey(DocumentVersion),
@@ -722,5 +705,5 @@ const DocumentValidationResult = Schema.Struct({
722
705
  }).annotate({ identifier: "DocumentValidationResult" });
723
706
 
724
707
  //#endregion
725
- export { DOCUMENT_ACTIONS as $, RemoveDocumentInput as A, SeoCapabilities as B, MarkdownNode as C, MediaTooLarge as Ct, PublishedDocumentPage as D, Locale as Dt, PublishedDocumentLookup as E, CollectionName as Et, DocumentSeo as F, SeoRevision as G, SeoConfirmationRequired as H, GlobalSeoSettings as I, SeoUrl as J, SeoSnapshot as K, PublishSeoInput as L, UndeleteDocumentInput as M, UnpublishDocumentInput as N, PublishedDocumentQuery as O, SourceDirectory as Ot, UpdateDocumentInput as P, AuthenticationRequired as Q, SaveSeoInput as R, DuplicateDocumentInput as S, MediaStatus as St, PublishDocumentInput as T, AddressPattern as Tt, SeoMediaUnavailable as U, SeoConfiguration as V, SeoMutationResult as W, SitemapEntry as X, SeoVersionConflict as Y, AccessDenied as Z, DocumentSource as _, MediaObjectKey as _t, DOCUMENT_REVISION_ACTIONS as a, ImageMimeType as at, DocumentSurround as b, MediaReference as bt, DocumentImportInput as c, MediaCleanupReport as ct, DocumentIssue as d, MediaFolder as dt, MEDIA_ACTIONS as et, DocumentMutationResult as f, MediaId as ft, DocumentRevisionAction as g, MediaNotFound as gt, DocumentQueryScalar as h, MediaName as ht, CreateDocumentInput as i, StudioRequestContext as it, RestoreDocumentInput as j, PublishedDocumentSurroundQuery as k, RequestId as kt, DocumentImportReport as l, MediaConflict as lt, DocumentNavigationQuery as m, MediaInvalid as mt, CmsMarkdownDocument as n, StudioActor as nt, DeletedDocument as o, MediaAsset as ot, DocumentNavigationItem as p, MediaIntegrityReport as pt, SeoState as q, CompiledDocument as r, StudioEntryDenied as rt, DocumentBrowseQuery as s, MediaByteSize as st, CmsDocumentAnalysis as t, Role as tt, DocumentImportSource as u, MediaCursor as ut, DocumentSourceMapping as v, MediaPage as vt, MoveDocumentInput as w, MediaUpload as wt, DocumentValidationResult as x, MediaReferenced as xt, DocumentSummary as y, MediaQuery as yt, SeoCanonicalOrigin as z };
726
- //# sourceMappingURL=models-DwYioyNV.js.map
708
+ export { StudioActor as $, UnpublishDocumentInput as A, SeoMediaUnavailable as B, PublishedDocumentLookup as C, CollectionName as Ct, RemoveDocumentInput as D, PublishedDocumentSurroundQuery as E, RequestId as Et, SaveSeoInput as F, SeoUrl as G, SeoRevision as H, SeoCanonicalOrigin as I, AccessDenied as J, SeoVersionConflict as K, SeoCapabilities as L, DocumentSeo as M, GlobalSeoSettings as N, RestoreDocumentInput as O, PublishSeoInput as P, Role as Q, SeoConfiguration as R, PublishDocumentInput as S, AddressPattern as St, PublishedDocumentQuery as T, SourceDirectory as Tt, SeoSnapshot as U, SeoMutationResult as V, SeoState as W, DOCUMENT_ACTIONS as X, AuthenticationRequired as Y, MEDIA_ACTIONS as Z, DocumentSurround as _, MediaReference as _t, DOCUMENT_REVISION_ACTIONS as a, MediaCleanupReport as at, MarkdownNode as b, MediaTooLarge as bt, DocumentIssue as c, MediaFolder as ct, DocumentNavigationQuery as d, MediaInvalid as dt, StudioEntryDenied as et, DocumentQueryScalar as f, MediaName as ft, DocumentSummary as g, MediaQuery as gt, DocumentSourceMapping as h, MediaPage as ht, CreateDocumentInput as i, MediaByteSize as it, UpdateDocumentInput as j, UndeleteDocumentInput as k, DocumentMutationResult as l, MediaId as lt, DocumentSource as m, MediaObjectKey as mt, CmsMarkdownDocument as n, ImageMimeType as nt, DeletedDocument as o, MediaConflict as ot, DocumentRevisionAction as p, MediaNotFound as pt, SitemapEntry as q, CompiledDocument as r, MediaAsset as rt, DocumentBrowseQuery as s, MediaCursor as st, CmsDocumentAnalysis as t, StudioRequestContext as tt, DocumentNavigationItem as u, MediaIntegrityReport as ut, DocumentValidationResult as v, MediaReferenced as vt, PublishedDocumentPage as w, Locale as wt, MoveDocumentInput as x, MediaUpload as xt, DuplicateDocumentInput as y, MediaStatus as yt, SeoConfirmationRequired as z };
709
+ //# sourceMappingURL=models-Bah5B3bT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models-Bah5B3bT.js","names":[],"sources":["../../../../protocol/src/Identity.ts","../../../../protocol/src/internal/configuration/scalars.ts","../../../../protocol/src/Media.ts","../../../../protocol/src/AccessControl.ts","../../../../protocol/src/Seo.ts","../../../../protocol/src/internal/documents/models.ts"],"sourcesContent":["import { Schema } from 'effect'\n\nexport const RequestId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('RequestId'))\n\nexport type RequestId = typeof RequestId.Type\n","import { Schema } from 'effect'\nimport { publicPathPattern } from '../scalars'\n\nconst collectionNamePattern = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/u\n\nconst localePattern = /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u\n\nconst sourceDirectoryPattern = /^(?:\\.|(?!\\.)[^/?#\\\\]+(?:\\/(?!\\.)[^/?#\\\\]+)*)$/u\n\nexport const AddressPattern = Schema.String.check(Schema.isPattern(publicPathPattern)).pipe(\n Schema.brand('AddressPattern'),\n)\n\nexport type AddressPattern = typeof AddressPattern.Type\n\nexport const CollectionName = Schema.String.check(Schema.isPattern(collectionNamePattern)).pipe(\n Schema.brand('CollectionName'),\n)\n\nexport type CollectionName = typeof CollectionName.Type\n\nexport const Locale = Schema.String.check(Schema.isPattern(localePattern)).pipe(Schema.brand('Locale'))\n\nexport type Locale = typeof Locale.Type\n\nexport const SourceDirectory = Schema.String.check(Schema.isPattern(sourceDirectoryPattern)).pipe(\n Schema.brand('SourceDirectory'),\n)\n\nexport type SourceDirectory = typeof SourceDirectory.Type\n","/**\n * Media wire models. Search pages are newest-first with opaque continuation cursors; only ready\n * assets are public results, and names, folders, and object keys are validated path-safe values.\n */\nimport { Schema } from 'effect'\nimport { DocumentId, PublicPath, SourcePath } from './internal/documents/scalars'\nimport { nonNegativeInt } from './internal/scalars'\n\nconst hasUnsafeMediaCharacter = (value: string): boolean => {\n for (const character of value) {\n const codePoint = character.codePointAt(0)\n\n if (character === '\\\\' || (codePoint !== undefined && (codePoint <= 31 || codePoint === 127))) return true\n }\n\n return false\n}\n\nconst isSafeMediaPath = (value: string, allowEmpty: boolean): boolean => {\n if (value.length === 0) return allowEmpty\n\n if (value !== value.trim() || value.startsWith('/') || value.endsWith('/') || hasUnsafeMediaCharacter(value)) {\n return false\n }\n\n return value.split('/').every((segment) => segment.length > 0 && segment !== '.' && segment !== '..')\n}\n\nconst safeMediaFolder = Schema.makeFilter<string>((value) => isSafeMediaPath(value, true), {\n expected: 'a provider-relative media folder without traversal segments',\n})\n\nconst safeMediaObjectKey = Schema.makeFilter<string>((value) => isSafeMediaPath(value, false), {\n expected: 'a non-empty provider-relative media object key without traversal segments',\n})\n\nconst safeMediaName = Schema.makeFilter<string>(\n (value) =>\n value.length > 0 &&\n value.length <= 255 &&\n value === value.trim() &&\n value !== '.' &&\n value !== '..' &&\n !value.includes('/') &&\n !hasUnsafeMediaCharacter(value),\n { expected: 'a safe media file name of at most 255 characters' },\n)\n\nexport const MediaId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('MediaId'))\n\nexport type MediaId = typeof MediaId.Type\n\nexport const MediaFolder = Schema.String.check(Schema.isMaxLength(512), safeMediaFolder).pipe(\n Schema.brand('MediaFolder'),\n)\n\nexport type MediaFolder = typeof MediaFolder.Type\n\nexport const MediaObjectKey = Schema.String.check(Schema.isMaxLength(1024), safeMediaObjectKey).pipe(\n Schema.brand('MediaObjectKey'),\n)\n\nexport type MediaObjectKey = typeof MediaObjectKey.Type\n\nexport const MediaName = Schema.String.check(safeMediaName).pipe(Schema.brand('MediaName'))\n\nexport type MediaName = typeof MediaName.Type\n\nexport const MediaCursor = Schema.NonEmptyString.pipe(Schema.brand('MediaCursor'))\n\nexport type MediaCursor = typeof MediaCursor.Type\n\nexport const ImageMimeType = Schema.Literals(['image/avif', 'image/gif', 'image/jpeg', 'image/png', 'image/webp'])\n\nexport type ImageMimeType = typeof ImageMimeType.Type\n\nexport const MediaStatus = Schema.Literals(['uploading', 'ready', 'deleting'])\n\nexport type MediaStatus = typeof MediaStatus.Type\n\nexport const MediaByteSize = Schema.Int.check(Schema.isGreaterThan(0))\n\nexport type MediaByteSize = typeof MediaByteSize.Type\n\nexport const MediaAsset = Schema.Struct({\n kind: Schema.tag('image'),\n id: MediaId,\n objectKey: MediaObjectKey,\n url: Schema.NonEmptyString,\n name: MediaName,\n folder: MediaFolder,\n mimeType: ImageMimeType,\n byteSize: MediaByteSize,\n createdAt: Schema.DateTimeUtcFromString,\n updatedAt: Schema.DateTimeUtcFromString,\n status: MediaStatus,\n}).annotate({ identifier: 'MediaAsset' })\n\nexport interface MediaAsset extends Schema.Schema.Type<typeof MediaAsset> {}\n\nexport const MediaUpload = Schema.Struct({\n name: MediaName,\n folder: Schema.optionalKey(MediaFolder),\n declaredMimeType: Schema.optionalKey(Schema.NonEmptyString),\n declaredByteSize: MediaByteSize,\n}).annotate({ identifier: 'MediaUpload' })\n\nexport interface MediaUpload extends Schema.Schema.Type<typeof MediaUpload> {}\n\nexport const MediaQuery = Schema.Struct({\n cursor: Schema.optionalKey(MediaCursor),\n folder: Schema.optionalKey(MediaFolder),\n search: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(200))),\n limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 }))),\n}).annotate({ identifier: 'MediaQuery' })\n\nexport interface MediaQuery extends Schema.Schema.Type<typeof MediaQuery> {}\n\nconst ReadyMediaAssets = Schema.Array(MediaAsset).check(\n Schema.makeFilter((assets) => assets.every((asset) => asset.status === 'ready'), {\n expected: 'media assets whose lifecycle status is ready',\n }),\n)\n\nexport const MediaPage = Schema.Struct({\n assets: ReadyMediaAssets,\n folders: Schema.Array(MediaFolder),\n nextCursor: Schema.optionalKey(MediaCursor),\n total: nonNegativeInt,\n}).annotate({ identifier: 'MediaPage' })\n\nexport interface MediaPage extends Schema.Schema.Type<typeof MediaPage> {}\n\nexport const MediaReference = Schema.Struct({\n documentId: DocumentId,\n mediaId: Schema.optionalKey(MediaId),\n path: PublicPath,\n sourcePath: SourcePath,\n objectKey: MediaObjectKey,\n nodePath: Schema.Array(nonNegativeInt),\n}).annotate({ identifier: 'MediaReference' })\n\nexport interface MediaReference extends Schema.Schema.Type<typeof MediaReference> {}\n\nconst MediaObjectMismatch = Schema.Struct({\n asset: MediaAsset,\n storedByteSize: MediaByteSize,\n storedMimeType: Schema.optionalKey(ImageMimeType),\n}).annotate({ identifier: 'MediaObjectMismatch' })\n\nexport const MediaIntegrityReport = Schema.Struct({\n missingAssets: Schema.Array(MediaReference),\n missingObjects: Schema.Array(MediaAsset),\n mismatchedObjects: Schema.Array(MediaObjectMismatch),\n orphanedObjectKeys: Schema.Array(MediaObjectKey),\n unusedAssets: Schema.Array(MediaAsset),\n}).annotate({ identifier: 'MediaIntegrityReport' })\n\nexport interface MediaIntegrityReport extends Schema.Schema.Type<typeof MediaIntegrityReport> {}\n\nexport const MediaCleanupReport = Schema.Struct({\n removedObjectKeys: Schema.Array(MediaObjectKey),\n}).annotate({ identifier: 'MediaCleanupReport' })\n\nexport interface MediaCleanupReport extends Schema.Schema.Type<typeof MediaCleanupReport> {}\n\nexport class MediaNotFound extends Schema.TaggedError<MediaNotFound>()('Media.NotFound', {\n mediaId: MediaId,\n}) {}\n\nexport class MediaReferenced extends Schema.TaggedError<MediaReferenced>()('Media.Referenced', {\n mediaId: MediaId,\n references: Schema.Array(MediaReference),\n seoScopes: Schema.optionalKey(Schema.Array(Schema.Literals(['working', 'published']))),\n}) {}\n\nexport class MediaConflict extends Schema.TaggedError<MediaConflict>()('Media.Conflict', {\n mediaId: MediaId,\n}) {}\n\nexport class MediaInvalid extends Schema.TaggedError<MediaInvalid>()('Media.Invalid', {\n message: Schema.NonEmptyString,\n}) {}\n\nexport class MediaTooLarge extends Schema.TaggedError<MediaTooLarge>()('Media.TooLarge', {\n declaredByteSize: MediaByteSize,\n maxUploadBytes: MediaByteSize,\n}) {}\n","import { Schema } from 'effect'\nimport { RequestId } from './Identity'\nimport { CollectionName, Locale } from './internal/configuration/scalars'\nimport { DocumentId } from './internal/documents/scalars'\nimport { MediaFolder, MediaId } from './Media'\n\nexport const ROLES = ['administrator', 'editor', 'viewer'] as const\n\nexport const Role = Schema.Literals(ROLES)\n\nexport type Role = typeof Role.Type\n\nexport const StudioActor = Schema.Struct({\n id: Schema.NonEmptyString,\n email: Schema.NonEmptyString,\n name: Schema.NonEmptyString,\n // Provider roles remain visible, while access control recognizes only Role values.\n roles: Schema.Array(Schema.NonEmptyString),\n}).annotate({ identifier: 'StudioActor' })\n\nexport interface StudioActor extends Schema.Schema.Type<typeof StudioActor> {}\n\nexport const StudioRequestContext = Schema.Struct({\n actor: StudioActor,\n requestId: RequestId,\n}).annotate({ identifier: 'StudioRequestContext' })\n\nexport interface StudioRequestContext extends Schema.Schema.Type<typeof StudioRequestContext> {}\n\nexport const DOCUMENT_ACTIONS = [\n 'document.browse',\n 'document.read',\n 'document.trash',\n 'document.validate',\n 'document.create',\n 'document.update',\n 'document.move',\n 'document.remove',\n 'document.restore',\n 'document.undelete',\n 'document.publish',\n 'document.unpublish',\n 'document.duplicate',\n 'document.history',\n 'document.transfer',\n] as const\n\nconst DocumentAction = Schema.Literals(DOCUMENT_ACTIONS)\n\nconst DocumentCatalogResource = Schema.Struct({\n kind: Schema.tag('catalog'),\n})\n\nconst CollectionResource = Schema.Struct({\n kind: Schema.tag('collection'),\n collection: CollectionName,\n locale: Schema.optionalKey(Locale),\n})\n\nconst DocumentResource = Schema.Struct({\n kind: Schema.tag('document'),\n documentId: DocumentId,\n})\n\nconst DocumentAccessResource = Schema.Union([DocumentCatalogResource, CollectionResource, DocumentResource]).pipe(\n Schema.toTaggedUnion('kind'),\n)\n\nexport const DocumentAccessDecision = Schema.Struct({\n action: DocumentAction,\n resource: DocumentAccessResource,\n}).annotate({ identifier: 'DocumentAccessDecision' })\n\nexport interface DocumentAccessDecision extends Schema.Schema.Type<typeof DocumentAccessDecision> {}\n\nexport const MEDIA_ACTIONS = [\n 'media.read',\n 'media.search',\n 'media.integrity',\n 'media.upload',\n 'media.replace',\n 'media.remove',\n 'media.cleanup',\n] as const\n\nconst MediaAction = Schema.Literals(MEDIA_ACTIONS)\n\nconst MediaCatalogResource = Schema.Struct({\n kind: Schema.tag('media-catalog'),\n})\n\nconst MediaAssetResource = Schema.Struct({\n kind: Schema.tag('media-asset'),\n mediaId: MediaId,\n})\n\nconst MediaFolderResource = Schema.Struct({\n kind: Schema.tag('media-folder'),\n folder: MediaFolder,\n})\n\nconst MediaResource = Schema.Union([MediaCatalogResource, MediaAssetResource, MediaFolderResource]).pipe(\n Schema.toTaggedUnion('kind'),\n)\n\nexport const MediaAccessDecision = Schema.Struct({\n action: MediaAction,\n resource: MediaResource,\n}).annotate({ identifier: 'MediaAccessDecision' })\n\nexport interface MediaAccessDecision extends Schema.Schema.Type<typeof MediaAccessDecision> {}\n\nconst ActivityResource = Schema.Struct({\n kind: Schema.tag('activity'),\n})\n\nconst ActivityAccessDecision = Schema.Struct({\n action: Schema.Literal('activity.read'),\n resource: ActivityResource,\n}).annotate({ identifier: 'ActivityAccessDecision' })\n\nexport const SEO_ACTIONS = ['seo.read', 'seo.save', 'seo.publish'] as const\n\nconst SeoAction = Schema.Literals(SEO_ACTIONS)\n\nconst SeoResource = Schema.Struct({ kind: Schema.tag('seo') })\n\nexport const SeoAccessDecision = Schema.Struct({\n action: SeoAction,\n resource: SeoResource,\n}).annotate({ identifier: 'SeoAccessDecision' })\n\nexport interface SeoAccessDecision extends Schema.Schema.Type<typeof SeoAccessDecision> {}\n\nconst STUDIO_ACTIONS = [...DOCUMENT_ACTIONS, ...MEDIA_ACTIONS, ...SEO_ACTIONS, 'activity.read'] as const\n\nexport const StudioAction = Schema.Literals(STUDIO_ACTIONS)\n\nexport type StudioAction = typeof StudioAction.Type\n\nconst StudioResource = Schema.Union([DocumentAccessResource, MediaResource, ActivityResource, SeoResource])\n\nexport const StudioAccessDecision = Schema.Union([\n DocumentAccessDecision,\n MediaAccessDecision,\n ActivityAccessDecision,\n SeoAccessDecision,\n])\n\nexport type StudioAccessDecision = typeof StudioAccessDecision.Type\n\nexport class AuthenticationRequired extends Schema.TaggedError<AuthenticationRequired>()(\n 'Studio.AuthenticationRequired',\n {},\n) {}\n\nexport class StudioEntryDenied extends Schema.TaggedError<StudioEntryDenied>()('Studio.EntryDenied', {}) {}\n\nexport class AccessDenied extends Schema.TaggedError<AccessDenied>()('Studio.AccessDenied', {\n action: StudioAction,\n actorId: StudioActor.fields.id,\n resource: StudioResource,\n}) {}\n","import { DateTime, Option, Schema } from 'effect'\nimport { StudioActor } from './AccessControl'\nimport { MediaId } from './Media'\nimport { Locale } from './internal/configuration/scalars'\nimport { PublicPath } from './internal/documents/scalars'\n\nconst absoluteUrl = Schema.makeFilter<string>(\n (value) => {\n try {\n const url = new URL(value)\n\n return url.protocol === 'http:' || url.protocol === 'https:'\n } catch {\n return false\n }\n },\n { expected: 'an absolute HTTP or HTTPS URL' },\n)\n\nconst canonicalOrigin = Schema.makeFilter<string>(\n (value) => {\n try {\n const url = new URL(value)\n\n return (\n (url.protocol === 'http:' || url.protocol === 'https:') &&\n url.origin === value &&\n url.pathname === '/' &&\n url.search === '' &&\n url.hash === ''\n )\n } catch {\n return false\n }\n },\n { expected: 'an HTTP or HTTPS origin without a path, query, hash, or trailing slash' },\n)\n\nconst titleTemplate = Schema.makeFilter<string>((value) => value.includes('%s'), {\n expected: 'a title template containing %s',\n})\n\nconst calendarDate = Schema.makeFilter<string>(\n (value) => {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/u.test(value)) return false\n const parsed = DateTime.make(value)\n\n return Option.isSome(parsed) && DateTime.formatIsoDate(parsed.value) === value\n },\n { expected: 'a valid calendar date in YYYY-MM-DD format' },\n)\n\nexport const SeoUrl = Schema.NonEmptyString.check(absoluteUrl).pipe(Schema.brand('SeoUrl'))\n\nexport type SeoUrl = typeof SeoUrl.Type\n\nexport const SeoCanonicalOrigin = Schema.NonEmptyString.check(canonicalOrigin).pipe(Schema.brand('SeoCanonicalOrigin'))\n\nexport type SeoCanonicalOrigin = typeof SeoCanonicalOrigin.Type\n\nexport const SeoImage = Schema.Struct({\n mediaId: MediaId,\n url: SeoUrl,\n alt: Schema.NonEmptyString,\n}).annotate({ identifier: 'SeoImage' })\n\nexport interface SeoImage extends Schema.Schema.Type<typeof SeoImage> {}\n\nexport const StructuredDataType = Schema.Literals(['WebPage', 'Article'])\n\nexport type StructuredDataType = typeof StructuredDataType.Type\n\nconst WebPageStructuredData = Schema.Struct({\n type: Schema.tag('WebPage'),\n})\n\nconst ArticleStructuredData = Schema.Struct({\n type: Schema.tag('Article'),\n headline: Schema.optionalKey(Schema.NonEmptyString),\n datePublished: Schema.optionalKey(Schema.String.check(calendarDate)),\n dateModified: Schema.optionalKey(Schema.String.check(calendarDate)),\n})\n\nexport const DocumentStructuredData = Schema.Union([WebPageStructuredData, ArticleStructuredData]).pipe(\n Schema.toTaggedUnion('type'),\n)\n\nexport type DocumentStructuredData = typeof DocumentStructuredData.Type\n\nexport const IdentityType = Schema.Literals(['Person', 'Organization', 'LocalBusiness'])\n\nexport type IdentityType = typeof IdentityType.Type\n\nconst identityFields = {\n name: Schema.NonEmptyString,\n url: Schema.optionalKey(SeoUrl),\n}\n\nconst PersonIdentity = Schema.Struct({\n type: Schema.tag('Person'),\n ...identityFields,\n image: Schema.optionalKey(SeoImage),\n})\n\nconst OrganizationIdentity = Schema.Struct({\n type: Schema.tag('Organization'),\n ...identityFields,\n logo: Schema.optionalKey(SeoImage),\n})\n\nexport const PostalAddress = Schema.Struct({\n streetAddress: Schema.optionalKey(Schema.NonEmptyString),\n addressLocality: Schema.optionalKey(Schema.NonEmptyString),\n addressRegion: Schema.optionalKey(Schema.NonEmptyString),\n postalCode: Schema.optionalKey(Schema.NonEmptyString),\n addressCountry: Schema.optionalKey(Schema.NonEmptyString),\n}).annotate({ identifier: 'PostalAddress' })\n\nexport interface PostalAddress extends Schema.Schema.Type<typeof PostalAddress> {}\n\nconst LocalBusinessIdentity = Schema.Struct({\n type: Schema.tag('LocalBusiness'),\n ...identityFields,\n logo: Schema.optionalKey(SeoImage),\n image: Schema.optionalKey(SeoImage),\n telephone: Schema.optionalKey(Schema.NonEmptyString),\n address: Schema.optionalKey(PostalAddress),\n})\n\nexport const SiteIdentity = Schema.Union([PersonIdentity, OrganizationIdentity, LocalBusinessIdentity]).pipe(\n Schema.toTaggedUnion('type'),\n)\n\nexport type SiteIdentity = typeof SiteIdentity.Type\n\nexport const DocumentSeo = Schema.Struct({\n title: Schema.optionalKey(Schema.NonEmptyString),\n description: Schema.optionalKey(Schema.NonEmptyString),\n socialTitle: Schema.optionalKey(Schema.NonEmptyString),\n socialDescription: Schema.optionalKey(Schema.NonEmptyString),\n socialImage: Schema.optionalKey(SeoImage),\n index: Schema.optionalKey(Schema.Boolean),\n follow: Schema.optionalKey(Schema.Boolean),\n canonicalUrl: Schema.optionalKey(SeoUrl),\n structuredData: Schema.optionalKey(DocumentStructuredData),\n}).annotate({ identifier: 'DocumentSeo' })\n\nexport interface DocumentSeo extends Schema.Schema.Type<typeof DocumentSeo> {}\n\nexport const GlobalSeoSettings = Schema.Struct({\n siteName: Schema.NonEmptyString,\n defaultDescription: Schema.optionalKey(Schema.NonEmptyString),\n canonicalOrigin: SeoCanonicalOrigin,\n titleTemplate: Schema.optionalKey(Schema.NonEmptyString.check(titleTemplate)),\n socialTitle: Schema.optionalKey(Schema.NonEmptyString),\n socialDescription: Schema.optionalKey(Schema.NonEmptyString),\n socialImage: Schema.optionalKey(SeoImage),\n index: Schema.Boolean,\n follow: Schema.Boolean,\n identity: Schema.optionalKey(SiteIdentity),\n}).annotate({ identifier: 'GlobalSeoSettings' })\n\nexport interface GlobalSeoSettings extends Schema.Schema.Type<typeof GlobalSeoSettings> {}\n\nexport const SeoCapabilities = Schema.Struct({\n structuredDataTypes: Schema.Array(StructuredDataType),\n identityTypes: Schema.Array(IdentityType),\n generatedSocialImageTemplateIds: Schema.Array(Schema.NonEmptyString),\n}).annotate({ identifier: 'SeoCapabilities' })\n\nexport interface SeoCapabilities extends Schema.Schema.Type<typeof SeoCapabilities> {}\n\nexport const SeoConfiguration = Schema.Struct({\n defaults: GlobalSeoSettings,\n capabilities: SeoCapabilities,\n}).annotate({ identifier: 'SeoConfiguration' })\n\nexport interface SeoConfiguration extends Schema.Schema.Type<typeof SeoConfiguration> {}\n\nexport const ResolvedSeo = Schema.Struct({\n title: Schema.NonEmptyString,\n description: Schema.optionalKey(Schema.NonEmptyString),\n socialTitle: Schema.NonEmptyString,\n socialDescription: Schema.optionalKey(Schema.NonEmptyString),\n socialImage: Schema.optionalKey(SeoImage),\n canonicalUrl: SeoUrl,\n index: Schema.Boolean,\n follow: Schema.Boolean,\n structuredData: Schema.optionalKey(DocumentStructuredData),\n identity: Schema.optionalKey(SiteIdentity),\n}).annotate({ identifier: 'ResolvedSeo' })\n\nexport interface ResolvedSeo extends Schema.Schema.Type<typeof ResolvedSeo> {}\n\nexport const SeoVersion = Schema.NonEmptyString.pipe(Schema.brand('SeoVersion'))\n\nexport type SeoVersion = typeof SeoVersion.Type\n\nexport const SeoRevisionId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('SeoRevisionId'))\n\nexport type SeoRevisionId = typeof SeoRevisionId.Type\n\nexport const SeoRevision = Schema.Struct({\n revisionId: SeoRevisionId,\n version: SeoVersion,\n settings: GlobalSeoSettings,\n editedBy: StudioActor,\n editedAt: Schema.DateTimeUtcFromString,\n}).annotate({ identifier: 'SeoRevision' })\n\nexport interface SeoRevision extends Schema.Schema.Type<typeof SeoRevision> {}\n\nexport const SeoState = Schema.Struct({\n working: SeoRevision,\n published: Schema.optionalKey(SeoRevision),\n capabilities: SeoCapabilities,\n}).annotate({ identifier: 'SeoState' })\n\nexport interface SeoState extends Schema.Schema.Type<typeof SeoState> {}\n\nexport const SeoSnapshot = Schema.Struct({\n revision: SeoRevision,\n capabilities: SeoCapabilities,\n}).annotate({ identifier: 'SeoSnapshot' })\n\nexport interface SeoSnapshot extends Schema.Schema.Type<typeof SeoSnapshot> {}\n\nconst mutationMetadata = {\n reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1_000))),\n confirmedSiteWideChange: Schema.optionalKey(Schema.Boolean),\n}\n\nexport const SaveSeoInput = Schema.Struct({\n expectedVersion: SeoVersion,\n settings: GlobalSeoSettings,\n ...mutationMetadata,\n}).annotate({ identifier: 'SaveSeoInput' })\n\nexport interface SaveSeoInput extends Schema.Schema.Type<typeof SaveSeoInput> {}\n\nexport const PublishSeoInput = Schema.Struct({\n expectedVersion: SeoVersion,\n ...mutationMetadata,\n}).annotate({ identifier: 'PublishSeoInput' })\n\nexport interface PublishSeoInput extends Schema.Schema.Type<typeof PublishSeoInput> {}\n\nexport const SeoMutationResult = Schema.Struct({\n action: Schema.Literals(['seo.save', 'seo.publish']),\n state: SeoState,\n}).annotate({ identifier: 'SeoMutationResult' })\n\nexport interface SeoMutationResult extends Schema.Schema.Type<typeof SeoMutationResult> {}\n\nexport const SitemapAlternative = Schema.Struct({\n locale: Locale,\n loc: PublicPath,\n}).annotate({ identifier: 'SitemapAlternative' })\n\nexport interface SitemapAlternative extends Schema.Schema.Type<typeof SitemapAlternative> {}\n\nexport const SitemapEntry = Schema.Struct({\n loc: PublicPath,\n lastmod: Schema.DateTimeUtcFromString,\n alternatives: Schema.optionalKey(Schema.Array(SitemapAlternative)),\n}).annotate({ identifier: 'SitemapEntry' })\n\nexport interface SitemapEntry extends Schema.Schema.Type<typeof SitemapEntry> {}\n\nexport const SeoConfirmationChange = Schema.Literals(['canonicalOrigin', 'indexability'])\n\nexport type SeoConfirmationChange = typeof SeoConfirmationChange.Type\n\nexport class SeoVersionConflict extends Schema.TaggedError<SeoVersionConflict>()('Seo.VersionConflict', {\n expectedVersion: SeoVersion,\n actualVersion: SeoVersion,\n}) {}\n\nexport class SeoConfirmationRequired extends Schema.TaggedError<SeoConfirmationRequired>()('Seo.ConfirmationRequired', {\n changes: Schema.Array(SeoConfirmationChange),\n}) {}\n\nexport class SeoMediaUnavailable extends Schema.TaggedError<SeoMediaUnavailable>()('Seo.MediaUnavailable', {\n mediaId: MediaId,\n}) {}\n","import { Schema } from 'effect'\nimport { StudioActor } from '../../AccessControl'\nimport { CollectionName, Locale } from '../configuration/scalars'\nimport { nonNegativeInt } from '../scalars'\nimport { DocumentSeo, ResolvedSeo } from '../../Seo'\nimport {\n DocumentGeneration,\n DocumentVersion,\n DocumentId,\n PublicPath,\n RelativeDocumentPath,\n RevisionId,\n Slug,\n SourcePath,\n} from './scalars'\n\nexport const DocumentIssueCode = Schema.Literals([\n 'document.collision',\n 'document.id',\n 'document.invalid',\n 'i18n.missing-translation',\n 'markdown.parse',\n 'reference.document',\n 'reference.component',\n 'seo.invalid',\n 'schema.option',\n 'schema.constraint',\n 'schema.required',\n 'schema.type',\n 'schema.unknown',\n])\n\nexport type DocumentIssueCode = typeof DocumentIssueCode.Type\n\nexport const DocumentIssue = Schema.Struct({\n code: DocumentIssueCode,\n severity: Schema.Literals(['error', 'warning']),\n message: Schema.NonEmptyString,\n sourcePath: Schema.optionalKey(SourcePath),\n collection: Schema.optionalKey(CollectionName),\n field: Schema.optionalKey(Schema.NonEmptyString),\n key: Schema.optionalKey(PublicPath),\n locale: Schema.optionalKey(Locale),\n}).annotate({ identifier: 'DocumentIssue' })\n\nexport interface DocumentIssue extends Schema.Schema.Type<typeof DocumentIssue> {}\n\nexport const DocumentSourcePoint = Schema.Struct({\n offset: nonNegativeInt,\n line: nonNegativeInt,\n column: nonNegativeInt,\n})\n\nexport interface DocumentSourcePoint extends Schema.Schema.Type<typeof DocumentSourcePoint> {}\n\nexport const DocumentSourceRange = Schema.Struct({\n start: DocumentSourcePoint,\n end: DocumentSourcePoint,\n})\n\nexport interface DocumentSourceRange extends Schema.Schema.Type<typeof DocumentSourceRange> {}\n\nexport const DocumentSourceMapping = Schema.Struct({\n nodePath: Schema.Array(nonNegativeInt),\n range: DocumentSourceRange,\n})\n\nexport interface DocumentSourceMapping extends Schema.Schema.Type<typeof DocumentSourceMapping> {}\n\nexport type MarkdownNode =\n | string\n | readonly [null, Schema.JsonObject, string]\n | readonly [string, Schema.JsonObject, ...MarkdownNode[]]\n\nexport const MarkdownNode: Schema.Codec<MarkdownNode> = Schema.suspend(() =>\n Schema.Union([\n Schema.String,\n Schema.Tuple([Schema.Null, Schema.JsonObject, Schema.String]),\n Schema.TupleWithRest(Schema.Tuple([Schema.NonEmptyString, Schema.JsonObject]), [MarkdownNode]),\n ]),\n)\n\nexport const CmsMarkdownDocument = Schema.Struct({\n nodes: Schema.Array(MarkdownNode),\n frontmatter: Schema.JsonObject,\n meta: Schema.JsonObject,\n}).annotate({ identifier: 'CmsMarkdownDocument' })\n\nexport interface CmsMarkdownDocument extends Schema.Schema.Type<typeof CmsMarkdownDocument> {}\n\nexport const CmsDocumentHeading = Schema.Struct({\n depth: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 6 })),\n id: Schema.String,\n text: Schema.String,\n})\n\nexport interface CmsDocumentHeading extends Schema.Schema.Type<typeof CmsDocumentHeading> {}\n\nexport const CmsDocumentAnalysis = Schema.Struct({\n components: Schema.Array(Schema.NonEmptyString),\n headings: Schema.Array(CmsDocumentHeading),\n searchText: Schema.String,\n summary: Schema.String,\n})\n\nexport interface CmsDocumentAnalysis extends Schema.Schema.Type<typeof CmsDocumentAnalysis> {}\n\nexport const CompiledDocumentSource = Schema.Struct({\n path: SourcePath,\n mappings: Schema.Array(DocumentSourceMapping),\n publishedAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n})\n\nexport interface CompiledDocumentSource extends Schema.Schema.Type<typeof CompiledDocumentSource> {}\n\nexport const CompiledDocument = Schema.Struct({\n id: DocumentId,\n key: PublicPath,\n path: PublicPath,\n locale: Schema.optionalKey(Locale),\n collection: CollectionName,\n draft: Schema.Boolean,\n title: Schema.NonEmptyString,\n description: Schema.optionalKey(Schema.String),\n seo: Schema.optionalKey(DocumentSeo),\n resolvedSeo: Schema.optionalKey(ResolvedSeo),\n data: Schema.JsonObject,\n issues: Schema.Array(DocumentIssue),\n analysis: CmsDocumentAnalysis,\n body: CmsMarkdownDocument,\n engineFingerprint: Schema.NonEmptyString,\n source: CompiledDocumentSource,\n}).annotate({ identifier: 'CompiledDocument' })\n\nexport interface CompiledDocument extends Schema.Schema.Type<typeof CompiledDocument> {}\n\nconst documentAttribution = {\n createdBy: Schema.optionalKey(StudioActor),\n editedBy: Schema.optionalKey(StudioActor),\n editedAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n}\n\nexport const DocumentSource = Schema.Struct({\n ...documentAttribution,\n documentId: DocumentId,\n sourcePath: SourcePath,\n markdown: Schema.String,\n revisionId: RevisionId,\n version: DocumentVersion,\n publishedVersion: Schema.optionalKey(DocumentVersion),\n}).annotate({ identifier: 'DocumentSource' })\n\nexport interface DocumentSource extends Schema.Schema.Type<typeof DocumentSource> {}\n\nexport const DocumentSummary = Schema.Struct({\n ...documentAttribution,\n publishedVersion: Schema.optionalKey(DocumentVersion),\n publishedPath: Schema.optionalKey(PublicPath),\n sourcePath: SourcePath,\n version: DocumentVersion,\n document: CompiledDocument,\n}).annotate({ identifier: 'DocumentSummary' })\n\nexport interface DocumentSummary extends Schema.Schema.Type<typeof DocumentSummary> {}\n\nexport const DeletedDocument = Schema.Struct({\n title: Schema.optionalKey(Schema.String),\n path: Schema.optionalKey(PublicPath),\n trashBatchId: Schema.optionalKey(DocumentVersion),\n documentId: DocumentId,\n deletedAt: Schema.DateTimeUtcFromString,\n sourcePath: SourcePath,\n version: DocumentVersion,\n}).annotate({ identifier: 'DeletedDocument' })\n\nexport interface DeletedDocument extends Schema.Schema.Type<typeof DeletedDocument> {}\n\nexport const DocumentBrowseQuery = Schema.Struct({\n collection: Schema.optionalKey(CollectionName),\n locale: Schema.optionalKey(Locale),\n}).annotate({ identifier: 'DocumentBrowseQuery' })\n\nexport interface DocumentBrowseQuery extends Schema.Schema.Type<typeof DocumentBrowseQuery> {}\n\nexport const PublishedDocumentLookup = Schema.Union([\n Schema.Struct({\n kind: Schema.tag('id'),\n documentId: DocumentId,\n }),\n Schema.Struct({\n kind: Schema.tag('path'),\n path: PublicPath,\n }),\n Schema.Struct({\n kind: Schema.tag('key'),\n key: PublicPath,\n collection: Schema.optionalKey(CollectionName),\n locale: Schema.optionalKey(Locale),\n }),\n]).pipe(Schema.toTaggedUnion('kind'))\n\nexport type PublishedDocumentLookup = typeof PublishedDocumentLookup.Type\n\nexport const DocumentQueryScalar = Schema.Union([Schema.String, Schema.Finite, Schema.Boolean, Schema.Null])\n\nexport type DocumentQueryScalar = typeof DocumentQueryScalar.Type\n\nconst validDocumentQueryField = Schema.makeFilter<string>(\n (field) => {\n const segments = field.split('.')\n\n return field.length <= 200 && segments.length <= 8 && segments.every((segment) => segment.length > 0)\n },\n { expected: 'a non-empty field path of at most 200 characters and eight non-empty segments' },\n)\n\nexport const DocumentQueryField = Schema.NonEmptyString.check(validDocumentQueryField)\n\nexport type DocumentQueryField = typeof DocumentQueryField.Type\n\nexport const DocumentQueryValue = Schema.Union([\n DocumentQueryScalar,\n Schema.Array(DocumentQueryScalar).check(Schema.isMaxLength(20)),\n])\n\nexport type DocumentQueryValue = typeof DocumentQueryValue.Type\n\nexport const DocumentQuerySort = Schema.Struct({\n field: DocumentQueryField,\n direction: Schema.optionalKey(Schema.Literals(['asc', 'desc'])),\n})\n\nexport interface DocumentQuerySort extends Schema.Schema.Type<typeof DocumentQuerySort> {}\n\nconst DocumentQueryWhere = Schema.Record(Schema.String, DocumentQueryValue).check(\n Schema.makeFilter((where) => Object.keys(where).every((field) => Schema.is(DocumentQueryField)(field)), {\n expected: 'document query keys with valid bounded field paths',\n }),\n Schema.makeFilter((where) => Object.keys(where).length <= 12, {\n expected: 'at most 12 document query filters',\n }),\n)\n\nexport const PublishedDocumentSelection = Schema.Struct({\n collection: Schema.optionalKey(CollectionName),\n locale: Schema.optionalKey(Locale),\n where: Schema.optionalKey(DocumentQueryWhere),\n sort: Schema.optionalKey(Schema.Array(DocumentQuerySort).check(Schema.isMaxLength(4))),\n}).annotate({ identifier: 'PublishedDocumentSelection' })\n\nexport interface PublishedDocumentSelection extends Schema.Schema.Type<typeof PublishedDocumentSelection> {}\n\nexport const PublishedDocumentQuery = Schema.Struct({\n ...PublishedDocumentSelection.fields,\n offset: Schema.optionalKey(nonNegativeInt),\n limit: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })),\n}).annotate({ identifier: 'PublishedDocumentQuery' })\n\nexport interface PublishedDocumentQuery extends Schema.Schema.Type<typeof PublishedDocumentQuery> {}\n\nexport const PublishedDocumentSurroundQuery = Schema.Struct({\n ...PublishedDocumentSelection.fields,\n}).annotate({ identifier: 'PublishedDocumentSurroundQuery' })\n\nexport interface PublishedDocumentSurroundQuery extends Schema.Schema.Type<typeof PublishedDocumentSurroundQuery> {}\n\nexport const PublishedDocumentPage = Schema.Struct({\n items: Schema.Array(CompiledDocument),\n total: nonNegativeInt,\n}).annotate({ identifier: 'PublishedDocumentPage' })\n\nexport interface PublishedDocumentPage extends Schema.Schema.Type<typeof PublishedDocumentPage> {}\n\nexport const DocumentNavigationQuery = Schema.Struct({\n collection: Schema.optionalKey(CollectionName),\n locale: Schema.optionalKey(Locale),\n}).annotate({ identifier: 'DocumentNavigationQuery' })\n\nexport interface DocumentNavigationQuery extends Schema.Schema.Type<typeof DocumentNavigationQuery> {}\n\nconst documentMutationMetadata = {\n reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1_000))),\n}\n\nexport interface DocumentNavigationItem {\n readonly key: PublicPath\n readonly title: string\n readonly path?: PublicPath\n readonly locale?: Locale\n readonly documentId?: DocumentId\n readonly children: ReadonlyArray<DocumentNavigationItem>\n}\n\ninterface DocumentNavigationItemEncoded {\n readonly key: string\n readonly title: string\n readonly path?: string\n readonly locale?: string\n readonly documentId?: string\n readonly children: ReadonlyArray<DocumentNavigationItemEncoded>\n}\n\nexport const DocumentNavigationItem: Schema.Codec<DocumentNavigationItem, DocumentNavigationItemEncoded> =\n Schema.suspend(() =>\n Schema.Struct({\n key: PublicPath,\n title: Schema.NonEmptyString,\n path: Schema.optionalKey(PublicPath),\n locale: Schema.optionalKey(Locale),\n documentId: Schema.optionalKey(DocumentId),\n children: Schema.Array(DocumentNavigationItem),\n }),\n )\n\nexport const DocumentSurround = Schema.Struct({\n previous: Schema.NullOr(CompiledDocument),\n next: Schema.NullOr(CompiledDocument),\n}).annotate({ identifier: 'DocumentSurround' })\n\nexport interface DocumentSurround extends Schema.Schema.Type<typeof DocumentSurround> {}\n\nexport const HomeDocumentLocation = Schema.Struct({\n kind: Schema.tag('home'),\n})\n\nexport interface HomeDocumentLocation extends Schema.Schema.Type<typeof HomeDocumentLocation> {}\n\nexport const NestedDocumentLocation = Schema.Struct({\n kind: Schema.tag('entry'),\n parent: Schema.optionalKey(RelativeDocumentPath),\n slug: Slug,\n})\n\nexport interface NestedDocumentLocation extends Schema.Schema.Type<typeof NestedDocumentLocation> {}\n\nexport const DocumentLocation = Schema.Union([HomeDocumentLocation, NestedDocumentLocation]).pipe(\n Schema.toTaggedUnion('kind'),\n)\n\nexport type DocumentLocation = typeof DocumentLocation.Type\n\nexport const CreateDocumentInput = Schema.Struct({\n collection: CollectionName,\n locale: Schema.optionalKey(Locale),\n location: DocumentLocation,\n title: Schema.NonEmptyString,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'CreateDocumentInput' })\n\nexport interface CreateDocumentInput extends Schema.Schema.Type<typeof CreateDocumentInput> {}\n\nexport const UpdateDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n markdown: Schema.String,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'UpdateDocumentInput' })\n\nexport interface UpdateDocumentInput extends Schema.Schema.Type<typeof UpdateDocumentInput> {}\n\nexport const MoveDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n location: DocumentLocation,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'MoveDocumentInput' })\n\nexport interface MoveDocumentInput extends Schema.Schema.Type<typeof MoveDocumentInput> {}\n\nexport const DuplicateDocumentInput = Schema.Struct({\n ...MoveDocumentInput.fields,\n includeChildren: Schema.Boolean,\n}).annotate({ identifier: 'DuplicateDocumentInput' })\n\nexport interface DuplicateDocumentInput extends Schema.Schema.Type<typeof DuplicateDocumentInput> {}\n\nexport const UnpublishDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'UnpublishDocumentInput' })\n\nexport interface UnpublishDocumentInput extends Schema.Schema.Type<typeof UnpublishDocumentInput> {}\n\nexport const RemoveDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'RemoveDocumentInput' })\n\nexport interface RemoveDocumentInput extends Schema.Schema.Type<typeof RemoveDocumentInput> {}\n\nexport const PublishDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'PublishDocumentInput' })\n\nexport interface PublishDocumentInput extends Schema.Schema.Type<typeof PublishDocumentInput> {}\n\nexport const RestoreDocumentInput = Schema.Struct({\n documentId: DocumentId,\n revisionId: RevisionId,\n expectedVersion: DocumentVersion,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'RestoreDocumentInput' })\n\nexport interface RestoreDocumentInput extends Schema.Schema.Type<typeof RestoreDocumentInput> {}\n\nexport const UndeleteDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'UndeleteDocumentInput' })\n\nexport interface UndeleteDocumentInput extends Schema.Schema.Type<typeof UndeleteDocumentInput> {}\n\nexport const DOCUMENT_REVISION_ACTIONS = [\n 'document.create',\n 'document.move',\n 'document.remove',\n 'document.restore',\n 'document.undelete',\n 'document.update',\n] as const\n\nexport const DocumentRevisionAction = Schema.Literals(DOCUMENT_REVISION_ACTIONS)\n\nexport type DocumentRevisionAction = typeof DocumentRevisionAction.Type\n\nexport const DocumentMutationAction = Schema.Literals([\n ...DOCUMENT_REVISION_ACTIONS,\n 'document.publish',\n 'document.unpublish',\n])\n\nexport type DocumentMutationAction = typeof DocumentMutationAction.Type\n\nexport const DocumentMutationResult = Schema.Struct({\n action: DocumentMutationAction,\n affectedDocumentIds: Schema.optionalKey(Schema.Array(DocumentId)),\n documentId: DocumentId,\n generation: DocumentGeneration,\n revisionId: RevisionId,\n sourcePath: SourcePath,\n version: DocumentVersion,\n entry: Schema.optionalKey(DocumentSummary),\n}).annotate({ identifier: 'DocumentMutationResult' })\n\nexport interface DocumentMutationResult extends Schema.Schema.Type<typeof DocumentMutationResult> {}\n\nexport const DocumentValidationResult = Schema.Struct({\n valid: Schema.Boolean,\n document: Schema.optionalKey(CompiledDocument),\n issues: Schema.Array(DocumentIssue),\n}).annotate({ identifier: 'DocumentValidationResult' })\n\nexport interface DocumentValidationResult extends Schema.Schema.Type<typeof DocumentValidationResult> {}\n"],"mappings":";;;;AAEA,MAAa,YAAY,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,WAAW,CAAC;;;;ACC5F,MAAM,wBAAwB;AAE9B,MAAM,gBAAgB;AAEtB,MAAM,yBAAyB;AAE/B,MAAa,iBAAiB,OAAO,OAAO,MAAM,OAAO,UAAU,iBAAiB,CAAC,CAAC,CAAC,KACrF,OAAO,MAAM,gBAAgB,CAC/B;AAIA,MAAa,iBAAiB,OAAO,OAAO,MAAM,OAAO,UAAU,qBAAqB,CAAC,CAAC,CAAC,KACzF,OAAO,MAA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CAAC;AAID,MAAa,yBAAyB,OAAO,OAAO;CAClD,QAAQ;CACR,qBAAqB,OAAO,YAAY,OAAO,MAAM,UAAU,CAAC;CAChE,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,OAAO,OAAO,YAAY,eAAe;AAC3C,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,yBAAyB,CAAC;AAIpD,MAAa,2BAA2B,OAAO,OAAO;CACpD,OAAO,OAAO;CACd,UAAU,OAAO,YAAY,gBAAgB;CAC7C,QAAQ,OAAO,MAAM,aAAa;AACpC,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,2BAA2B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as readPreviewLocation } from "../../location-CFKTeK1K.js";
1
+ import { n as readPreviewLocation } from "../../location-BTqdfIzX.js";
2
2
  import { useRequestURL, useState } from "nuxt/app";
3
3
 
4
4
  //#region src/runtime/delivery/context.ts
@@ -1,12 +1,18 @@
1
- import { n as readPreviewLocation, t as previewRedirect } from "../../location-CFKTeK1K.js";
1
+ import { n as readPreviewLocation, t as previewRedirect } from "../../location-BTqdfIzX.js";
2
2
  import { usePreviewDelivery } from "./context.js";
3
3
  import { installCmsDocumentSeoAdapters } from "./useCmsDocumentSeo.js";
4
- import { watch } from "vue";
5
- import { addRouteMiddleware, defineNuxtPlugin, useHead, useRequestURL, useResponseHeader, useSeoMeta } from "nuxt/app";
4
+ import { localeFromPath } from "../i18n/translator.js";
5
+ import { computed, watch } from "vue";
6
+ import { addRouteMiddleware, defineNuxtPlugin, useHead, useRequestURL, useResponseHeader, useRoute, useSeoMeta } from "nuxt/app";
7
+ import configuration from "#cms/i18n";
6
8
  import { useRobotsRule, useSchemaOrg } from "#imports";
7
9
 
8
10
  //#region src/runtime/delivery/plugin.ts
9
11
  var plugin_default = defineNuxtPlugin(() => {
12
+ if (configuration.defaultLocale) {
13
+ const route = useRoute();
14
+ useHead({ htmlAttrs: { lang: computed(() => localeFromPath(configuration, route.path)) } });
15
+ }
10
16
  installCmsDocumentSeoAdapters({
11
17
  head: (input) => {
12
18
  useHead(input);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","names":[],"sources":["../../../../../src/runtime/delivery/plugin.ts"],"sourcesContent":["import { addRouteMiddleware, defineNuxtPlugin, useHead, useRequestURL, useResponseHeader, useSeoMeta } from 'nuxt/app'\nimport { useRobotsRule, useSchemaOrg } from '#imports'\nimport { previewRedirect, readPreviewLocation } from '@internal/protocol/Preview'\nimport { watch } from 'vue'\nimport { usePreviewDelivery } from './context'\nimport { installCmsDocumentSeoAdapters } from './useCmsDocumentSeo'\n\nexport default defineNuxtPlugin(() => {\n installCmsDocumentSeoAdapters({\n head: (input) => {\n useHead(input)\n },\n robots: (input) => {\n const robots = useRobotsRule(input)\n\n if (import.meta.server) {\n watch(\n input,\n (value) => {\n robots.value = value\n },\n { flush: 'sync' },\n )\n }\n },\n schema: (input) => {\n useSchemaOrg(input)\n },\n seoMeta: (input) => {\n useSeoMeta(input)\n },\n })\n\n const url = useRequestURL()\n const parameters = readPreviewLocation(url)\n const preview = usePreviewDelivery()\n\n if (!preview.value || !parameters) return\n\n if (import.meta.server) {\n useResponseHeader('cache-control').value = 'private, no-store'\n useResponseHeader('x-frame-options').value = 'SAMEORIGIN'\n }\n\n addRouteMiddleware(\n 'cms-preview',\n (to) => {\n return previewRedirect(new URL(to.fullPath, url.origin), parameters)\n },\n { global: true },\n )\n})\n"],"mappings":";;;;;;;;AAOA,qBAAe,uBAAuB;CACpC,8BAA8B;EAC5B,OAAO,UAAU;GACf,QAAQ,KAAK;EACf;EACA,SAAS,UAAU;GACjB,MAAM,SAAS,cAAc,KAAK;GAElC,IAAI,YAAY,QACd,MACE,QACC,UAAU;IACT,OAAO,QAAQ;GACjB,GACA,EAAE,OAAO,OAAO,CAClB;EAEJ;EACA,SAAS,UAAU;GACjB,aAAa,KAAK;EACpB;EACA,UAAU,UAAU;GAClB,WAAW,KAAK;EAClB;CACF,CAAC;CAED,MAAM,MAAM,cAAc;CAC1B,MAAM,aAAa,oBAAoB,GAAG;CAG1C,IAAI,CAFY,mBAEL,CAAC,CAAC,SAAS,CAAC,YAAY;CAEnC,IAAI,YAAY,QAAQ;EACtB,kBAAkB,eAAe,CAAC,CAAC,QAAQ;EAC3C,kBAAkB,iBAAiB,CAAC,CAAC,QAAQ;CAC/C;CAEA,mBACE,gBACC,OAAO;EACN,OAAO,gBAAgB,IAAI,IAAI,GAAG,UAAU,IAAI,MAAM,GAAG,UAAU;CACrE,GACA,EAAE,QAAQ,KAAK,CACjB;AACF,CAAC"}
1
+ {"version":3,"file":"plugin.js","names":[],"sources":["../../../../../src/runtime/delivery/plugin.ts"],"sourcesContent":["import configuration from '#cms/i18n'\nimport {\n addRouteMiddleware,\n defineNuxtPlugin,\n useHead,\n useRequestURL,\n useResponseHeader,\n useRoute,\n useSeoMeta,\n} from 'nuxt/app'\nimport { useRobotsRule, useSchemaOrg } from '#imports'\nimport { previewRedirect, readPreviewLocation } from '@internal/protocol/Preview'\nimport { computed, watch } from 'vue'\nimport { usePreviewDelivery } from './context'\nimport { installCmsDocumentSeoAdapters } from './useCmsDocumentSeo'\nimport { localeFromPath } from '../i18n/translator'\n\nexport default defineNuxtPlugin(() => {\n if (configuration.defaultLocale) {\n const route = useRoute()\n\n useHead({ htmlAttrs: { lang: computed(() => localeFromPath(configuration, route.path)) } })\n }\n\n installCmsDocumentSeoAdapters({\n head: (input) => {\n useHead(input)\n },\n robots: (input) => {\n const robots = useRobotsRule(input)\n\n if (import.meta.server) {\n watch(\n input,\n (value) => {\n robots.value = value\n },\n { flush: 'sync' },\n )\n }\n },\n schema: (input) => {\n useSchemaOrg(input)\n },\n seoMeta: (input) => {\n useSeoMeta(input)\n },\n })\n\n const url = useRequestURL()\n const parameters = readPreviewLocation(url)\n const preview = usePreviewDelivery()\n\n if (!preview.value || !parameters) return\n\n if (import.meta.server) {\n useResponseHeader('cache-control').value = 'private, no-store'\n useResponseHeader('x-frame-options').value = 'SAMEORIGIN'\n }\n\n addRouteMiddleware(\n 'cms-preview',\n (to) => {\n return previewRedirect(new URL(to.fullPath, url.origin), parameters)\n },\n { global: true },\n )\n})\n"],"mappings":";;;;;;;;;;AAiBA,qBAAe,uBAAuB;CACpC,IAAI,cAAc,eAAe;EAC/B,MAAM,QAAQ,SAAS;EAEvB,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,eAAe,eAAe,MAAM,IAAI,CAAC,EAAE,EAAE,CAAC;CAC5F;CAEA,8BAA8B;EAC5B,OAAO,UAAU;GACf,QAAQ,KAAK;EACf;EACA,SAAS,UAAU;GACjB,MAAM,SAAS,cAAc,KAAK;GAElC,IAAI,YAAY,QACd,MACE,QACC,UAAU;IACT,OAAO,QAAQ;GACjB,GACA,EAAE,OAAO,OAAO,CAClB;EAEJ;EACA,SAAS,UAAU;GACjB,aAAa,KAAK;EACpB;EACA,UAAU,UAAU;GAClB,WAAW,KAAK;EAClB;CACF,CAAC;CAED,MAAM,MAAM,cAAc;CAC1B,MAAM,aAAa,oBAAoB,GAAG;CAG1C,IAAI,CAFY,mBAEL,CAAC,CAAC,SAAS,CAAC,YAAY;CAEnC,IAAI,YAAY,QAAQ;EACtB,kBAAkB,eAAe,CAAC,CAAC,QAAQ;EAC3C,kBAAkB,iBAAiB,CAAC,CAAC,QAAQ;CAC/C;CAEA,mBACE,gBACC,OAAO;EACN,OAAO,gBAAgB,IAAI,IAAI,GAAG,UAAU,IAAI,MAAM,GAAG,UAAU;CACrE,GACA,EAAE,QAAQ,KAAK,CACjB;AACF,CAAC"}
@@ -36,6 +36,9 @@ interface CmsPageSchemaNode {
36
36
  export type CmsSeoSchemaNode = CmsIdentitySchemaNode | CmsPageSchemaNode;
37
37
  export interface CmsDocumentSeoAdapters {
38
38
  readonly head: (input: () => {
39
+ htmlAttrs?: {
40
+ lang: string;
41
+ };
39
42
  link: Array<{
40
43
  href: string;
41
44
  rel: 'canonical';