@phtngyn/cms 0.1.0-beta.5 → 0.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -5
- package/package.json +11 -1
- package/src/ApplicationTypes.d.ts +82 -0
- package/src/ApplicationTypes.js +1 -0
- package/src/{Configuration-CDMYfTre.js → Configuration-CjVUBBwa.js} +3 -3
- package/src/{Configuration-CDMYfTre.js.map → Configuration-CjVUBBwa.js.map} +1 -1
- package/src/Configuration.d.ts +9 -4
- package/src/Configuration.js.map +1 -1
- package/src/Content.d.ts +67 -0
- package/src/Content.js +291 -0
- package/src/Content.js.map +1 -0
- package/src/ContentTransfer-CRQet3QJ.d.ts +48 -0
- package/src/{ContentTransfer-C3Av9sWz.js → ContentTransfer-CTzGGKFV.js} +8 -4
- package/src/ContentTransfer-CTzGGKFV.js.map +1 -0
- package/src/{DocumentEngine-J7g-emdf.js → DocumentEngine-BbhfnTAc.js} +4 -4
- package/src/{DocumentEngine-J7g-emdf.js.map → DocumentEngine-BbhfnTAc.js.map} +1 -1
- package/src/DocumentModel.d.ts +8 -1
- package/src/DocumentModel.js +29 -2
- package/src/DocumentModel.js.map +1 -1
- package/src/{Forms-Dj6NuW66.js → Forms-02-p8qEw.js} +2 -2
- package/src/{Forms-Dj6NuW66.js.map → Forms-02-p8qEw.js.map} +1 -1
- package/src/{Forms-BsJMev5_.d.ts → Forms-BorTcIlp.d.ts} +2 -5
- package/src/Forms.d.ts +25 -14
- package/src/Forms.js.map +1 -1
- package/src/I18n-BXlVunfa.d.ts +27 -0
- package/src/I18n.d.ts +2 -20
- package/src/Module.js +14 -5
- package/src/Module.js.map +1 -1
- package/src/{S3MediaObjects-CpPSzJto.js → S3MediaObjects-DC0c8sYC.js} +54 -35
- package/src/{S3MediaObjects-CpPSzJto.js.map → S3MediaObjects-DC0c8sYC.js.map} +1 -1
- package/src/cli/content.js +63 -221
- package/src/cli/content.js.map +1 -1
- package/src/cli.js +93 -4
- package/src/cli.js.map +1 -1
- package/src/{connection-CBAy2qGy.js → connection-BPf4BQUZ.js} +2 -2
- package/src/{connection-CBAy2qGy.js.map → connection-BPf4BQUZ.js.map} +1 -1
- package/src/dev-lifecycle-vQLxwCFq.js +428 -0
- package/src/dev-lifecycle-vQLxwCFq.js.map +1 -0
- package/src/{installation-CNfIriVm.js → installation-DsGst1BH.js} +578 -457
- package/src/installation-DsGst1BH.js.map +1 -0
- package/src/internal/application-types.js +43 -0
- package/src/internal/application-types.js.map +1 -0
- package/src/internal/authoring-catalog.js +9 -4
- package/src/internal/authoring-catalog.js.map +1 -1
- package/src/internal/authoring-metadata.js +1 -1
- package/src/internal/configuration.js +10 -6
- package/src/internal/configuration.js.map +1 -1
- package/src/internal/dev-lifecycle.js +3 -0
- package/src/internal/document-model.js +2 -2
- package/src/internal/document-model.js.map +1 -1
- package/src/internal/i18n.js +21 -0
- package/src/internal/i18n.js.map +1 -1
- package/src/{location-BTqdfIzX.js → location-BgYhXEZp.js} +2 -2
- package/src/{location-BTqdfIzX.js.map → location-BgYhXEZp.js.map} +1 -1
- package/src/{models-Bah5B3bT.js → models-DgkGTFus.js} +6 -1
- package/src/models-DgkGTFus.js.map +1 -0
- package/src/{models-B4IoTmp7.js → models-k2nXyD6q.js} +2 -2
- package/src/{models-B4IoTmp7.js.map → models-k2nXyD6q.js.map} +1 -1
- package/src/runtime/delivery/context.js +1 -1
- package/src/runtime/delivery/plugin.js +27 -5
- package/src/runtime/delivery/plugin.js.map +1 -1
- package/src/runtime/delivery/preview.d.ts +1 -1
- package/src/runtime/delivery/types.d.ts +2 -85
- package/src/runtime/delivery/useCmsDocumentSeo.d.ts +8 -1
- package/src/runtime/delivery/useCmsDocumentSeo.js +19 -7
- package/src/runtime/delivery/useCmsDocumentSeo.js.map +1 -1
- package/src/runtime/delivery/useDocument.d.ts +2 -2
- package/src/runtime/delivery/useDocument.js.map +1 -1
- package/src/runtime/delivery/useDocumentQuery.d.ts +3 -3
- package/src/runtime/delivery/useDocumentQuery.js.map +1 -1
- package/src/runtime/forms/document.js +1 -1
- package/src/runtime/forms/useCmsForm.js +81 -41
- package/src/runtime/forms/useCmsForm.js.map +1 -1
- package/src/runtime/i18n/useCmsI18n.d.ts +9 -7
- package/src/runtime/i18n/useCmsI18n.js +5 -4
- package/src/runtime/i18n/useCmsI18n.js.map +1 -1
- package/src/runtime/installation.js +2 -2
- package/src/runtime/plugin.js +1 -1
- package/src/runtime/preview/connection.js +1 -1
- package/src/runtime/preview/controller.js +2 -2
- package/src/runtime/preview/plugin.client.js +3 -3
- package/src/runtime/preview/store.js +1 -1
- package/src/runtime/sitemap.js +1 -1
- package/src/scalars-CA6kyipS.d.ts +7 -0
- package/src/{store-b2CSXgMt.js → store-BYgSt7E3.js} +3 -3
- package/src/{store-b2CSXgMt.js.map → store-BYgSt7E3.js.map} +1 -1
- package/src/types-DutFRtaG.d.ts +90 -0
- package/studio/{CreateDocumentDialog-GGey1uBc.js → CreateDocumentDialog-BdiM77bb.js} +1 -1
- package/studio/{documentPlanning-DRErYmBU.js → documentPlanning-B7fyUj9r.js} +7072 -7065
- package/studio/host.js +2 -2
- package/src/ContentTransfer-C3Av9sWz.js.map +0 -1
- package/src/installation-CNfIriVm.js.map +0 -1
- package/src/models-Bah5B3bT.js.map +0 -1
package/README.md
CHANGED
|
@@ -40,7 +40,10 @@ function env(name: string): string {
|
|
|
40
40
|
|
|
41
41
|
export default defineCmsConfig({
|
|
42
42
|
baseUrl: env('CMS_BASE_URL'), // Website origin, e.g. http://localhost:3000
|
|
43
|
-
|
|
43
|
+
database: {
|
|
44
|
+
url: env('DATABASE_URL'),
|
|
45
|
+
schema: 'cms',
|
|
46
|
+
},
|
|
44
47
|
secret: env('CMS_SECRET'),
|
|
45
48
|
initializationToken: env('CMS_INITIALIZATION_TOKEN'),
|
|
46
49
|
documents: {
|
|
@@ -57,6 +60,7 @@ export default defineCmsConfig({
|
|
|
57
60
|
publicBaseUrl: env('S3_PUBLIC_URL'),
|
|
58
61
|
storage: {
|
|
59
62
|
bucket: env('S3_BUCKET'),
|
|
63
|
+
prefix: 'cms/',
|
|
60
64
|
region: env('S3_REGION'),
|
|
61
65
|
credentials: {
|
|
62
66
|
accessKeyId: env('S3_ACCESS_KEY_ID'),
|
|
@@ -74,6 +78,23 @@ These environment variable names are examples; configuration is executable TypeS
|
|
|
74
78
|
|
|
75
79
|
For storage using the AWS credential chain, omit `credentials`. To create a missing bucket automatically, set `provisionBucket: true` and grant bucket-creation permission. Set `media: false` to start without uploads.
|
|
76
80
|
|
|
81
|
+
The PostgreSQL schema and S3 prefix are the installation's ownership boundary. CMS creates and migrates only the configured schema, and every media object stays under the configured prefix.
|
|
82
|
+
|
|
83
|
+
## Local development lifecycle
|
|
84
|
+
|
|
85
|
+
Use the supported lifecycle before starting Nuxt:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
cms dev doctor
|
|
89
|
+
CMS_EMAIL=admin@example.test CMS_PASSWORD=admin@example.test cms dev bootstrap --content ./content --publish
|
|
90
|
+
cms dev reset --database --media
|
|
91
|
+
cms dev reset --database --media --yes --bootstrap --content ./content --publish
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`doctor` is read-only and reports pass, fail, or not-verified for configuration, PostgreSQL, migrations, S3, public media, packaged assets, readiness, and WebSockets. Add `--full` to validate pending migrations in a rolled-back transaction and probe database writes plus an actual publicly readable S3 object, or `--json` for editor and CI integrations. `bootstrap` prepares the Nuxt authoring catalog, provisions infrastructure, runs migrations, creates or updates the requested local administrator, and optionally plans and applies content without requiring a running server. Passwords come from `CMS_PASSWORD` or a private prompt.
|
|
95
|
+
|
|
96
|
+
`reset` is a dry run unless `--yes` is present. It refuses to run while the configured CMS is live and can remove only the configured PostgreSQL schema and S3 prefix. Choose `--database`, `--media`, or both.
|
|
97
|
+
|
|
77
98
|
## Content CLI
|
|
78
99
|
|
|
79
100
|
The installed package provides a `cms` command for importing a plain Markdown folder, exporting Studio-authored Markdown, and moving content between running CMS installations. Create the first administrator in Studio, then sign in to the CLI with that administrator's email and password. The CLI prompts for the site URL, administrator email, and password when they are missing. For noninteractive use, set `CMS_URL`, `CMS_EMAIL`, and `CMS_PASSWORD`; `--url` and `--email` can replace the first two variables. Use HTTPS outside localhost.
|
|
@@ -93,6 +114,30 @@ For a folder without `.cms-content.json`, the CLI reads nested `.md` and `.mdc`
|
|
|
93
114
|
|
|
94
115
|
The command tree is intentionally shared: future CMS operations can be added beside `content` without separate executables.
|
|
95
116
|
|
|
117
|
+
The same workflow is available to Node scripts without parsing CLI output:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import { createCmsContentClient, readCmsContentDirectory } from '@phtngyn/cms/Content'
|
|
121
|
+
|
|
122
|
+
const source = await readCmsContentDirectory('./content')
|
|
123
|
+
const client = createCmsContentClient({
|
|
124
|
+
baseUrl: 'http://localhost:3000',
|
|
125
|
+
credentials: {
|
|
126
|
+
email: process.env.CMS_EMAIL!,
|
|
127
|
+
password: process.env.CMS_PASSWORD!,
|
|
128
|
+
},
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
const plan = await client.plan(source, { overwrite: false, publish: true })
|
|
132
|
+
|
|
133
|
+
if (plan.valid) await client.apply(plan)
|
|
134
|
+
|
|
135
|
+
const document = await client.readDocument('8c62d2a7-b839-450a-bc08-5eccb420dc60')
|
|
136
|
+
await client.export({ directory: './content' })
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Plans expose creates, updates, publications, conflicts, issues, unchanged entries, and target-only sources. They are bound to their client, source, options, and generation; `apply(plan)` never replans. `readDocument(id)` returns the authored Markdown and exact publication state. `CmsContentError.code` provides stable authentication, not-found, conflict, validation, generation, filesystem, response, and network failure categories.
|
|
140
|
+
|
|
96
141
|
## Search and sharing
|
|
97
142
|
|
|
98
143
|
The module installs the focused Nuxt robots, sitemap, schema.org, and SEO utility modules. Published CMS pages receive canonical, robots, social-sharing, and structured-data metadata automatically. The sitemap contains only published, indexable documents and uses their publication revision time for `lastmod`; localized variants are emitted as alternatives when they share a document key.
|
|
@@ -130,6 +175,24 @@ Keep raw robots directives and Nuxt module configuration in application code. Th
|
|
|
130
175
|
|
|
131
176
|
Collections use **Standard Schema V1** for validation and **Standard JSON Schema V1** for the input structure Studio renders. This lets you keep your chosen validation library. Both contracts must be available on the collection schema; Standard Schema validation alone cannot describe controls. Studio requests draft 2020-12 JSON Schema input, resolves non-recursive local references, and runs the original validator when validating documents.
|
|
132
177
|
|
|
178
|
+
The public standards types come directly from `@standard-schema/spec`. For a validator whose JSON Schema adapter is separate, `defineCmsSchema()` combines both contracts and applies library-neutral presentation to nested field paths:
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
import { defineCmsSchema } from '@phtngyn/cms/DocumentModel'
|
|
182
|
+
|
|
183
|
+
const pageSchema = defineCmsSchema({
|
|
184
|
+
validator: page,
|
|
185
|
+
jsonSchema: {
|
|
186
|
+
input: () => createInputSchema(page),
|
|
187
|
+
output: () => createOutputSchema(page),
|
|
188
|
+
},
|
|
189
|
+
fields: {
|
|
190
|
+
description: { label: 'Description', input: 'textarea' },
|
|
191
|
+
'seo.description': { input: 'textarea' },
|
|
192
|
+
},
|
|
193
|
+
})
|
|
194
|
+
```
|
|
195
|
+
|
|
133
196
|
For a validator that already implements both standards, pass it directly as `schema`. Otherwise, adapt its validator and input/output JSON Schema converters:
|
|
134
197
|
|
|
135
198
|
```ts
|
|
@@ -186,6 +249,20 @@ Draft delivery requires the current Studio session and document access permissio
|
|
|
186
249
|
- Import `defineCmsBlock` from `@phtngyn/cms/Authoring` to declare editable props and slots in your Nuxt Vue components.
|
|
187
250
|
- Import Markdown folders with `cms content plan` and `cms content apply` after creating the first administrator.
|
|
188
251
|
|
|
252
|
+
Nuxt generates `#cms/types` whenever configuration, collection schemas, or authored blocks change. It includes collection, form, block, locale, message-key, and interpolation-parameter types. Collection schema outputs flow through `useDocument<'pages'>()` and `useDocumentQuery()`, including typed filter and sort paths. Registered form names and configured capabilities narrow `CmsFormDefinition<'contact-form'>`.
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
import type { CmsCollection, CmsFormDefinition, CmsLocale } from '#cms/types'
|
|
256
|
+
|
|
257
|
+
const page: CmsCollection<'pages'> | null = useDocument<'pages'>('/').data.value
|
|
258
|
+
const locale: CmsLocale = 'de'
|
|
259
|
+
const form = {} as CmsFormDefinition<'contact-form'>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
`useCmsI18n().t()` autocompletes configured keys and requires the exact placeholders in each message. Nuxt preparation rejects extra locale keys and inconsistent placeholders. Missing translations are allowed only when the configured fallback locale supplies the canonical message.
|
|
263
|
+
|
|
264
|
+
CMS also synchronizes owned document routes with Nuxt Site Config. The delivered document locale wins, the route prefix applies while delivery resolves, and non-CMS routes retain the application's Site Config. The locale drives `<html lang>`, Open Graph locale, structured-data language, canonical and alternate links, sitemap alternatives, and `useCmsI18n()`.
|
|
265
|
+
|
|
189
266
|
## Studio and authoring during development
|
|
190
267
|
|
|
191
268
|
Studio at `/_cms/app` is a separate HTML document, Vue application, and Tailwind build. It owns its Nuxt UI settings, styles, and overlays independently of the website. Your app root and layouts apply only to the website. Both applications use the same Nuxt server; no separate Studio server or port is required.
|
|
@@ -293,11 +370,14 @@ const {
|
|
|
293
370
|
stepIndex,
|
|
294
371
|
isFirstStep,
|
|
295
372
|
isLastStep,
|
|
296
|
-
|
|
373
|
+
submitting,
|
|
297
374
|
isSuccess,
|
|
298
375
|
isPreview,
|
|
299
|
-
|
|
300
|
-
|
|
376
|
+
submitError,
|
|
377
|
+
canSubmit,
|
|
378
|
+
invalidFields,
|
|
379
|
+
firstInvalidFieldId,
|
|
380
|
+
field,
|
|
301
381
|
next,
|
|
302
382
|
previous,
|
|
303
383
|
validate,
|
|
@@ -306,7 +386,7 @@ const {
|
|
|
306
386
|
} = useCmsForm(() => props.definition)
|
|
307
387
|
```
|
|
308
388
|
|
|
309
|
-
The composable accepts a value, ref, or getter and returns destructurable refs and functions. Use `
|
|
389
|
+
The composable accepts a value, ref, or getter and returns destructurable refs and functions. Use `field(id)` for each visible question. The cached controller exposes a writable `value`, `dirty`, `touched`, `valid`, one-item `errors`, `controlAttrs`, `helpAttrs`, `errorAttrs`, and `touch()`. Bind `controlAttrs` to the native control, `helpAttrs` to help text, and `errorAttrs` to the rendered error; CMS keeps their stable IDs and ARIA relationships aligned. Valid number answers become numbers, empty answers become null, and invalid number text remains visible to validation. Empty optional answers reach the server handler as null. `canSubmit`, `invalidFields`, and `firstInvalidFieldId` centralize form-level behavior, while `submitError` and `errors._form` cover transport and server failures.
|
|
310
390
|
|
|
311
391
|
`next()` validates the current step, `previous()` preserves answers, and `submit()` validates every step and returns whether submission succeeded. A required checkbox must be checked.
|
|
312
392
|
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"directory": "packages/nuxt"
|
|
18
18
|
},
|
|
19
19
|
"name": "@phtngyn/cms",
|
|
20
|
-
"version": "0.
|
|
20
|
+
"version": "0.2.0-beta.1",
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"bin",
|
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
"types": "./src/DocumentModel.d.ts",
|
|
44
44
|
"import": "./src/DocumentModel.js"
|
|
45
45
|
},
|
|
46
|
+
"./ApplicationTypes": {
|
|
47
|
+
"types": "./src/ApplicationTypes.d.ts",
|
|
48
|
+
"import": "./src/ApplicationTypes.js"
|
|
49
|
+
},
|
|
46
50
|
"./I18n": {
|
|
47
51
|
"types": "./src/I18n.d.ts",
|
|
48
52
|
"import": "./src/I18n.js"
|
|
@@ -50,6 +54,10 @@
|
|
|
50
54
|
"./Forms": {
|
|
51
55
|
"types": "./src/Forms.d.ts",
|
|
52
56
|
"import": "./src/Forms.js"
|
|
57
|
+
},
|
|
58
|
+
"./Content": {
|
|
59
|
+
"types": "./src/Content.d.ts",
|
|
60
|
+
"import": "./src/Content.js"
|
|
53
61
|
}
|
|
54
62
|
},
|
|
55
63
|
"dependencies": {
|
|
@@ -63,6 +71,7 @@
|
|
|
63
71
|
"@nuxt/schema": "^4.5.2",
|
|
64
72
|
"@nuxtjs/robots": "^6.2.2",
|
|
65
73
|
"@nuxtjs/sitemap": "^8.5.1",
|
|
74
|
+
"@standard-schema/spec": "^1.1.0",
|
|
66
75
|
"@tiptap/core": "^3.31.3",
|
|
67
76
|
"@tiptap/starter-kit": "^3.31.3",
|
|
68
77
|
"@tiptap/y-tiptap": "^3.0.9",
|
|
@@ -77,6 +86,7 @@
|
|
|
77
86
|
"nitropack": "^2.13.4",
|
|
78
87
|
"nuxt-schema-org": "^6.3.1",
|
|
79
88
|
"nuxt-seo-utils": "^8.5.0",
|
|
89
|
+
"nuxt-site-config": "^4.2.3",
|
|
80
90
|
"pg": "^8.23.0",
|
|
81
91
|
"typescript": "npm:typescript-native-bridge@6.0.3-bridge.16.tsgo.7.0.2",
|
|
82
92
|
"vite": "^8.3.0",
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { a as FormStep, n as FormDefinition, r as FormField } from "./Forms-BorTcIlp.js";
|
|
2
|
+
import { a as CmsMessageParameters, i as CmsMessageKey, r as CmsLocale } from "./I18n-BXlVunfa.js";
|
|
3
|
+
import { n as DeliveryDocumentPage, t as DeliveryDocument } from "./types-DutFRtaG.js";
|
|
4
|
+
import { Schema } from "effect";
|
|
5
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
+
//#region src/ApplicationTypes.d.ts
|
|
7
|
+
/** Nuxt augments this registry from the authored CMS configuration and component catalog. */
|
|
8
|
+
export interface CmsApplicationRegistry {}
|
|
9
|
+
type AuthoredConfiguration = CmsApplicationRegistry extends {
|
|
10
|
+
configuration: infer Configuration;
|
|
11
|
+
} ? Configuration : never;
|
|
12
|
+
type AuthoredCollections = AuthoredConfiguration extends {
|
|
13
|
+
documents: {
|
|
14
|
+
collections: infer Collections;
|
|
15
|
+
};
|
|
16
|
+
} ? Collections : Record<string, never>;
|
|
17
|
+
type AuthoredForms = AuthoredConfiguration extends {
|
|
18
|
+
forms: infer Forms;
|
|
19
|
+
} ? NonNullable<Forms> : Record<string, never>;
|
|
20
|
+
type CollectionSchema<Name extends keyof AuthoredCollections> = AuthoredCollections[Name] extends {
|
|
21
|
+
schema: infer CollectionSchema;
|
|
22
|
+
} ? CollectionSchema : never;
|
|
23
|
+
type SchemaOutput<Value> = Value extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Value> : Value extends Schema.Top ? Value['Type'] : never;
|
|
24
|
+
type JsonOutput<Value> = Value extends object ? Value : Record<string, never>;
|
|
25
|
+
export type CmsCollectionName = Extract<keyof AuthoredCollections, string>;
|
|
26
|
+
export type CmsFormName = Extract<keyof AuthoredForms, string>;
|
|
27
|
+
export type CmsBlockName = CmsApplicationRegistry extends {
|
|
28
|
+
blockName: infer Name extends string;
|
|
29
|
+
} ? Name : string;
|
|
30
|
+
export type CmsCollection<Name extends CmsCollectionName> = Omit<DeliveryDocument, 'body' | 'collection' | 'data' | 'locale'> & {
|
|
31
|
+
readonly body: Omit<DeliveryDocument['body'], 'frontmatter'> & {
|
|
32
|
+
readonly frontmatter: JsonOutput<SchemaOutput<CollectionSchema<Name>>>;
|
|
33
|
+
};
|
|
34
|
+
readonly collection: Name;
|
|
35
|
+
readonly data: JsonOutput<SchemaOutput<CollectionSchema<Name>>>;
|
|
36
|
+
readonly locale?: CmsLocale;
|
|
37
|
+
};
|
|
38
|
+
type FormCapabilities<Name extends CmsFormName> = AuthoredForms[Name] extends {
|
|
39
|
+
definition: infer Capabilities;
|
|
40
|
+
} ? Capabilities : never;
|
|
41
|
+
type FormFieldType<Name extends CmsFormName> = FormCapabilities<Name> extends {
|
|
42
|
+
fieldTypes: ReadonlyArray<infer FieldType>;
|
|
43
|
+
} ? Extract<FieldType, FormField['type']> : never;
|
|
44
|
+
type FormRuleProperty<Rule> = Rule extends 'required' ? 'required' : Rule extends 'minLength' ? 'minLength' : Rule extends 'maxLength' ? 'maxLength' : Rule extends 'min' ? 'min' : Rule extends 'max' ? 'max' : never;
|
|
45
|
+
type CmsFormField<Name extends CmsFormName> = Omit<FormField, 'max' | 'maxLength' | 'min' | 'minLength' | 'required' | 'type'> & Pick<FormField, FormRuleProperty<FormCapabilities<Name> extends {
|
|
46
|
+
rules: ReadonlyArray<infer Rule>;
|
|
47
|
+
} ? Rule : never>> & {
|
|
48
|
+
readonly type: FormFieldType<Name>;
|
|
49
|
+
};
|
|
50
|
+
type CmsFormStep<Name extends CmsFormName> = Omit<FormStep, 'fields'> & {
|
|
51
|
+
readonly fields: ReadonlyArray<CmsFormField<Name>>;
|
|
52
|
+
};
|
|
53
|
+
export type CmsFormDefinition<Name extends CmsFormName = CmsFormName> = Omit<FormDefinition, 'name' | 'steps'> & {
|
|
54
|
+
readonly name: Name;
|
|
55
|
+
readonly steps: ReadonlyArray<CmsFormStep<Name>>;
|
|
56
|
+
};
|
|
57
|
+
type Scalar = boolean | number | string | null;
|
|
58
|
+
type FieldPaths<Value> = Value extends ReadonlyArray<unknown> ? never : Value extends object ? { [Key in Extract<keyof Value, string>]: NonNullable<Value[Key]> extends Scalar | ReadonlyArray<Scalar> ? Key : `${Key}.${FieldPaths<NonNullable<Value[Key]>>}`; }[Extract<keyof Value, string>] : never;
|
|
59
|
+
type CollectionDataField<Name extends CmsCollectionName> = Extract<FieldPaths<CmsCollection<Name>['data']>, string>;
|
|
60
|
+
type FieldValue<Value, Path extends string> = Path extends `${infer Head}.${infer Tail}` ? Head extends keyof Value ? FieldValue<NonNullable<Value[Head]>, Tail> : never : Path extends keyof Value ? Value[Path] : never;
|
|
61
|
+
type DocumentField<Name extends CmsCollectionName> = 'collection' | 'description' | 'id' | 'key' | 'locale' | 'path' | 'source.path' | 'title' | CollectionDataField<Name> | `data.${CollectionDataField<Name>}`;
|
|
62
|
+
type DocumentFieldValue<Name extends CmsCollectionName, Field extends DocumentField<Name>> = Field extends `data.${infer Path}` ? FieldValue<CmsCollection<Name>['data'], Path> : Field extends CollectionDataField<Name> ? FieldValue<CmsCollection<Name>['data'], Field> : Field extends 'collection' ? Name : Field extends 'locale' ? CmsLocale : Field extends 'source.path' ? CmsCollection<Name>['source']['path'] : Field extends keyof CmsCollection<Name> ? CmsCollection<Name>[Field] : never;
|
|
63
|
+
type FilterValue<Value> = NonNullable<Value> extends ReadonlyArray<infer Item> ? Extract<NonNullable<Item>, Scalar> | ReadonlyArray<Extract<NonNullable<Item>, Scalar>> : Extract<NonNullable<Value>, Scalar> | ReadonlyArray<Extract<NonNullable<Value>, Scalar>>;
|
|
64
|
+
type CmsDocumentQueryWhere<Name extends CmsCollectionName> = { readonly [Field in DocumentField<Name>]?: FilterValue<DocumentFieldValue<Name, Field>>; };
|
|
65
|
+
export interface CmsDocumentQuerySort<Name extends CmsCollectionName> {
|
|
66
|
+
readonly direction?: 'asc' | 'desc';
|
|
67
|
+
readonly field: DocumentField<Name>;
|
|
68
|
+
}
|
|
69
|
+
export interface CmsDocumentQuery<Name extends CmsCollectionName = CmsCollectionName> {
|
|
70
|
+
readonly collection?: Name;
|
|
71
|
+
readonly locale?: CmsLocale;
|
|
72
|
+
readonly limit: number;
|
|
73
|
+
readonly offset?: number;
|
|
74
|
+
readonly sort?: CmsDocumentQuerySort<Name> | ReadonlyArray<CmsDocumentQuerySort<Name>>;
|
|
75
|
+
readonly where?: CmsDocumentQueryWhere<Name>;
|
|
76
|
+
}
|
|
77
|
+
export interface CmsDocumentPage<Name extends CmsCollectionName> extends Omit<DeliveryDocumentPage, 'items'> {
|
|
78
|
+
readonly items: ReadonlyArray<CmsCollection<Name>>;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export type { CmsLocale, CmsMessageKey, CmsMessageParameters };
|
|
82
|
+
//# sourceMappingURL=ApplicationTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Ct as CollectionName, St as AddressPattern, Tt as SourceDirectory, b as MarkdownNode, n as CmsMarkdownDocument, wt as Locale } from "./models-DgkGTFus.js";
|
|
1
2
|
import { r as FormCapabilities } from "./Forms-CfcI3tPU.js";
|
|
2
|
-
import { c as resolveCmsComarkAttributes, d as createCmsComarkRenderData, l as withCmsComarkProps, r as formStructureIssues, s as projectCmsEditorComponentAttributes } from "./Forms-
|
|
3
|
-
import { Ct as CollectionName, St as AddressPattern, Tt as SourceDirectory, b as MarkdownNode, n as CmsMarkdownDocument, wt as Locale } from "./models-Bah5B3bT.js";
|
|
3
|
+
import { c as resolveCmsComarkAttributes, d as createCmsComarkRenderData, l as withCmsComarkProps, r as formStructureIssues, s as projectCmsEditorComponentAttributes } from "./Forms-02-p8qEw.js";
|
|
4
4
|
import { a as createEditorNodeId, n as editorMetadata, o as editorNodeId } from "./metadata-BEZPWh-3.js";
|
|
5
5
|
import { Effect, Option, Predicate, Schema } from "effect";
|
|
6
6
|
import { Extension } from "@tiptap/core";
|
|
@@ -1030,4 +1030,4 @@ const MediaConfiguration = Schema.Struct({
|
|
|
1030
1030
|
|
|
1031
1031
|
//#endregion
|
|
1032
1032
|
export { finiteNumberAttribute as C, compactJsonAttributes as S, comarkTagForEditorMark as _, BlockAuthoring as a, encodeEditorImageAttributes as b, parseAuthoringContent as c, EditorRenderFailed as d, DOCUMENT_ENGINE_FINGERPRINT as f, EDITOR_MARK_TYPES as g, comarkToEditor as h, MediaConfiguration as i, validateCollectionBody as l, SOURCE_MAPPINGS_META_KEY as m, ComponentDefinition as n, createAuthoringDocumentValidator as o, createDocumentParser as p, DocumentConfiguration as r, createAuthoringSchema as s, AuthoringCatalog as t, EditorDocumentInvalid as u, isEditorMark as v, nonEmptyStringAttribute as w, normalizeEditorImageLayout as x, EDITOR_IMAGE_LAYOUT_ATTRIBUTE as y };
|
|
1033
|
-
//# sourceMappingURL=Configuration-
|
|
1033
|
+
//# sourceMappingURL=Configuration-CjVUBBwa.js.map
|