@cmssy/cli 0.22.4 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +435 -0
- package/package.json +25 -86
- package/LICENSE +0 -21
- package/README.md +0 -692
- package/config.d.ts +0 -3
- package/config.js +0 -4
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -340
- package/dist/cli.js.map +0 -1
- package/dist/commands/add-source.d.ts +0 -13
- package/dist/commands/add-source.d.ts.map +0 -1
- package/dist/commands/add-source.js +0 -273
- package/dist/commands/add-source.js.map +0 -1
- package/dist/commands/build.d.ts +0 -7
- package/dist/commands/build.d.ts.map +0 -1
- package/dist/commands/build.js +0 -127
- package/dist/commands/build.js.map +0 -1
- package/dist/commands/codegen.d.ts +0 -7
- package/dist/commands/codegen.d.ts.map +0 -1
- package/dist/commands/codegen.js +0 -150
- package/dist/commands/codegen.js.map +0 -1
- package/dist/commands/configure.d.ts +0 -6
- package/dist/commands/configure.d.ts.map +0 -1
- package/dist/commands/configure.js +0 -39
- package/dist/commands/configure.js.map +0 -1
- package/dist/commands/create.d.ts +0 -18
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -403
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -6
- package/dist/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev.js +0 -144
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -2
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -230
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/init.d.ts +0 -6
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -414
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/lib.d.ts +0 -17
- package/dist/commands/lib.d.ts.map +0 -1
- package/dist/commands/lib.js +0 -132
- package/dist/commands/lib.js.map +0 -1
- package/dist/commands/link.d.ts +0 -8
- package/dist/commands/link.d.ts.map +0 -1
- package/dist/commands/link.js +0 -116
- package/dist/commands/link.js.map +0 -1
- package/dist/commands/migrate.d.ts +0 -2
- package/dist/commands/migrate.d.ts.map +0 -1
- package/dist/commands/migrate.js +0 -231
- package/dist/commands/migrate.js.map +0 -1
- package/dist/commands/package.d.ts +0 -14
- package/dist/commands/package.d.ts.map +0 -1
- package/dist/commands/package.js +0 -137
- package/dist/commands/package.js.map +0 -1
- package/dist/commands/publish-block-buildtime.d.ts +0 -8
- package/dist/commands/publish-block-buildtime.d.ts.map +0 -1
- package/dist/commands/publish-block-buildtime.js +0 -290
- package/dist/commands/publish-block-buildtime.js.map +0 -1
- package/dist/commands/publish-template.d.ts +0 -22
- package/dist/commands/publish-template.d.ts.map +0 -1
- package/dist/commands/publish-template.js +0 -345
- package/dist/commands/publish-template.js.map +0 -1
- package/dist/commands/publish.d.ts +0 -15
- package/dist/commands/publish.d.ts.map +0 -1
- package/dist/commands/publish.js +0 -1003
- package/dist/commands/publish.js.map +0 -1
- package/dist/commands/skills.d.ts +0 -11
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js +0 -178
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/sync.d.ts +0 -6
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js +0 -208
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/test.d.ts +0 -8
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js +0 -60
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/upload.d.ts +0 -11
- package/dist/commands/upload.d.ts.map +0 -1
- package/dist/commands/upload.js +0 -128
- package/dist/commands/upload.js.map +0 -1
- package/dist/commands/workspaces.d.ts +0 -2
- package/dist/commands/workspaces.d.ts.map +0 -1
- package/dist/commands/workspaces.js +0 -62
- package/dist/commands/workspaces.js.map +0 -1
- package/dist/dev-ui/app.js +0 -1284
- package/dist/dev-ui/index.html +0 -1511
- package/dist/dev-ui-react/App.tsx +0 -164
- package/dist/dev-ui-react/__tests__/previewData.test.ts +0 -193
- package/dist/dev-ui-react/components/BlocksList.tsx +0 -232
- package/dist/dev-ui-react/components/Editor.tsx +0 -469
- package/dist/dev-ui-react/components/Preview.tsx +0 -146
- package/dist/dev-ui-react/hooks/useBlocks.ts +0 -80
- package/dist/dev-ui-react/index.html +0 -13
- package/dist/dev-ui-react/main.tsx +0 -8
- package/dist/dev-ui-react/styles.css +0 -856
- package/dist/dev-ui-react/types.ts +0 -45
- package/dist/skills/claude/cmssy-block.md +0 -454
- package/dist/skills/claude/cmssy-mcp-content.md +0 -235
- package/dist/test-helpers/index.d.ts +0 -23
- package/dist/test-helpers/index.d.ts.map +0 -1
- package/dist/test-helpers/index.js +0 -50
- package/dist/test-helpers/index.js.map +0 -1
- package/dist/types/block-config.d.ts +0 -6
- package/dist/types/block-config.d.ts.map +0 -1
- package/dist/types/block-config.js +0 -12
- package/dist/types/block-config.js.map +0 -1
- package/dist/types/publish-job.d.ts +0 -61
- package/dist/types/publish-job.d.ts.map +0 -1
- package/dist/types/publish-job.js +0 -13
- package/dist/types/publish-job.js.map +0 -1
- package/dist/utils/api-error.d.ts +0 -10
- package/dist/utils/api-error.d.ts.map +0 -1
- package/dist/utils/api-error.js +0 -55
- package/dist/utils/api-error.js.map +0 -1
- package/dist/utils/block-config.d.ts +0 -87
- package/dist/utils/block-config.d.ts.map +0 -1
- package/dist/utils/block-config.js +0 -214
- package/dist/utils/block-config.js.map +0 -1
- package/dist/utils/blocks-meta-cache.d.ts +0 -28
- package/dist/utils/blocks-meta-cache.d.ts.map +0 -1
- package/dist/utils/blocks-meta-cache.js +0 -72
- package/dist/utils/blocks-meta-cache.js.map +0 -1
- package/dist/utils/builder.d.ts +0 -34
- package/dist/utils/builder.d.ts.map +0 -1
- package/dist/utils/builder.js +0 -140
- package/dist/utils/builder.js.map +0 -1
- package/dist/utils/cmssy-config.d.ts +0 -16
- package/dist/utils/cmssy-config.d.ts.map +0 -1
- package/dist/utils/cmssy-config.js +0 -19
- package/dist/utils/cmssy-config.js.map +0 -1
- package/dist/utils/config.d.ts +0 -9
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js +0 -51
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/dependency-check.d.ts +0 -21
- package/dist/utils/dependency-check.d.ts.map +0 -1
- package/dist/utils/dependency-check.js +0 -56
- package/dist/utils/dependency-check.js.map +0 -1
- package/dist/utils/dev-generator/api-routes/blocks.d.ts +0 -3
- package/dist/utils/dev-generator/api-routes/blocks.d.ts.map +0 -1
- package/dist/utils/dev-generator/api-routes/blocks.js +0 -194
- package/dist/utils/dev-generator/api-routes/blocks.js.map +0 -1
- package/dist/utils/dev-generator/api-routes/config.d.ts +0 -2
- package/dist/utils/dev-generator/api-routes/config.d.ts.map +0 -1
- package/dist/utils/dev-generator/api-routes/config.js +0 -107
- package/dist/utils/dev-generator/api-routes/config.js.map +0 -1
- package/dist/utils/dev-generator/api-routes/preview.d.ts +0 -2
- package/dist/utils/dev-generator/api-routes/preview.d.ts.map +0 -1
- package/dist/utils/dev-generator/api-routes/preview.js +0 -50
- package/dist/utils/dev-generator/api-routes/preview.js.map +0 -1
- package/dist/utils/dev-generator/api-routes/workspaces.d.ts +0 -2
- package/dist/utils/dev-generator/api-routes/workspaces.d.ts.map +0 -1
- package/dist/utils/dev-generator/api-routes/workspaces.js +0 -128
- package/dist/utils/dev-generator/api-routes/workspaces.js.map +0 -1
- package/dist/utils/dev-generator/helpers.d.ts +0 -23
- package/dist/utils/dev-generator/helpers.d.ts.map +0 -1
- package/dist/utils/dev-generator/helpers.js +0 -128
- package/dist/utils/dev-generator/helpers.js.map +0 -1
- package/dist/utils/dev-generator/home-page.d.ts +0 -2
- package/dist/utils/dev-generator/home-page.d.ts.map +0 -1
- package/dist/utils/dev-generator/home-page.js +0 -643
- package/dist/utils/dev-generator/home-page.js.map +0 -1
- package/dist/utils/dev-generator/index.d.ts +0 -11
- package/dist/utils/dev-generator/index.d.ts.map +0 -1
- package/dist/utils/dev-generator/index.js +0 -85
- package/dist/utils/dev-generator/index.js.map +0 -1
- package/dist/utils/dev-generator/layout.d.ts +0 -3
- package/dist/utils/dev-generator/layout.d.ts.map +0 -1
- package/dist/utils/dev-generator/layout.js +0 -63
- package/dist/utils/dev-generator/layout.js.map +0 -1
- package/dist/utils/dev-generator/next-config.d.ts +0 -3
- package/dist/utils/dev-generator/next-config.d.ts.map +0 -1
- package/dist/utils/dev-generator/next-config.js +0 -111
- package/dist/utils/dev-generator/next-config.js.map +0 -1
- package/dist/utils/dev-generator/preview-pages.d.ts +0 -3
- package/dist/utils/dev-generator/preview-pages.d.ts.map +0 -1
- package/dist/utils/dev-generator/preview-pages.js +0 -833
- package/dist/utils/dev-generator/preview-pages.js.map +0 -1
- package/dist/utils/dev-generator.d.ts +0 -12
- package/dist/utils/dev-generator.d.ts.map +0 -1
- package/dist/utils/dev-generator.js +0 -1752
- package/dist/utils/dev-generator.js.map +0 -1
- package/dist/utils/field-schema.d.ts +0 -13
- package/dist/utils/field-schema.d.ts.map +0 -1
- package/dist/utils/field-schema.js +0 -182
- package/dist/utils/field-schema.js.map +0 -1
- package/dist/utils/graphql.d.ts +0 -39
- package/dist/utils/graphql.d.ts.map +0 -1
- package/dist/utils/graphql.js +0 -138
- package/dist/utils/graphql.js.map +0 -1
- package/dist/utils/lib-manifest.d.ts +0 -7
- package/dist/utils/lib-manifest.d.ts.map +0 -1
- package/dist/utils/lib-manifest.js +0 -59
- package/dist/utils/lib-manifest.js.map +0 -1
- package/dist/utils/publish-helpers.d.ts +0 -43
- package/dist/utils/publish-helpers.d.ts.map +0 -1
- package/dist/utils/publish-helpers.js +0 -215
- package/dist/utils/publish-helpers.js.map +0 -1
- package/dist/utils/publish-helpers.test.d.ts +0 -2
- package/dist/utils/publish-helpers.test.d.ts.map +0 -1
- package/dist/utils/publish-helpers.test.js +0 -24
- package/dist/utils/publish-helpers.test.js.map +0 -1
- package/dist/utils/resolve-workspace.d.ts +0 -6
- package/dist/utils/resolve-workspace.d.ts.map +0 -1
- package/dist/utils/resolve-workspace.js +0 -32
- package/dist/utils/resolve-workspace.js.map +0 -1
- package/dist/utils/scanner.d.ts +0 -42
- package/dist/utils/scanner.d.ts.map +0 -1
- package/dist/utils/scanner.js +0 -156
- package/dist/utils/scanner.js.map +0 -1
- package/dist/utils/schema-diff.d.ts +0 -22
- package/dist/utils/schema-diff.d.ts.map +0 -1
- package/dist/utils/schema-diff.js +0 -107
- package/dist/utils/schema-diff.js.map +0 -1
- package/dist/utils/source-collector.d.ts +0 -19
- package/dist/utils/source-collector.d.ts.map +0 -1
- package/dist/utils/source-collector.js +0 -565
- package/dist/utils/source-collector.js.map +0 -1
- package/dist/utils/theme-builder.d.ts +0 -12
- package/dist/utils/theme-builder.d.ts.map +0 -1
- package/dist/utils/theme-builder.js +0 -117
- package/dist/utils/theme-builder.js.map +0 -1
- package/dist/utils/type-generator.d.ts +0 -9
- package/dist/utils/type-generator.d.ts.map +0 -1
- package/dist/utils/type-generator.js +0 -86
- package/dist/utils/type-generator.js.map +0 -1
- package/dist/utils/version.d.ts +0 -10
- package/dist/utils/version.d.ts.map +0 -1
- package/dist/utils/version.js +0 -30
- package/dist/utils/version.js.map +0 -1
- package/dist/utils/versions.d.ts.map +0 -1
- package/dist/utils/versions.js.map +0 -1
- package/src/dev-app/app/api/blocks/[name]/config/route.ts +0 -140
- package/src/dev-app/app/api/blocks/route.ts +0 -61
- package/src/dev-app/app/api/config/route.ts +0 -98
- package/src/dev-app/app/api/context/route.ts +0 -126
- package/src/dev-app/app/api/preview/[name]/route.ts +0 -137
- package/src/dev-app/app/api/workspaces/route.ts +0 -124
- package/src/dev-app/app/layout.tsx +0 -18
- package/src/dev-app/app/page.tsx +0 -1785
- package/test.d.ts +0 -1
- package/test.js +0 -2
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: cmssy-mcp-content
|
|
3
|
-
description: "Rules for managing CMS content via cmssy MCP tools. Use when creating/editing pages, blocks, translations, forms, or layout blocks through MCP. Trigger on words: cmssy MCP, page, block content, translation, form, header, footer, layout, publish page, add_block_to_page, update_block_content, create_page, list_pages, i18n, language."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# cmssy-mcp-content
|
|
7
|
-
|
|
8
|
-
Rules and patterns for working with site content through cmssy MCP tools.
|
|
9
|
-
|
|
10
|
-
## Prerequisites
|
|
11
|
-
|
|
12
|
-
This skill assumes the `@cmssy/mcp-server` is configured as an MCP server in your Claude Code settings. If the tools below are unavailable, install and configure it:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install -g @cmssy/mcp-server
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Then register it in `~/.claude.json` (or your project `.mcp.json`) with your workspace token and workspace ID. See https://www.npmjs.com/package/@cmssy/mcp-server for the exact config snippet.
|
|
19
|
-
|
|
20
|
-
If the MCP tools (`list_pages`, `update_block_content`, etc.) aren't available in your session, this skill won't work - fall back to the Cmssy editor UI.
|
|
21
|
-
|
|
22
|
-
## When to use this skill
|
|
23
|
-
|
|
24
|
-
- Creating or editing pages via MCP
|
|
25
|
-
- Adding/updating block content or translations
|
|
26
|
-
- Working with layout blocks (header, footer)
|
|
27
|
-
- Managing page settings, SEO, or publishing
|
|
28
|
-
- Creating or managing forms and form submissions
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Rule 0: Discover the workspace's languages BEFORE editing
|
|
33
|
-
|
|
34
|
-
**Cmssy is multi-tenant and language-agnostic.** Every workspace picks its own set of languages — could be `en`, `pl`, `de`, `es`, `fr`, `zh`, `ja`, `ar`, `uk`, anything. **Never assume** a workspace uses `en`/`pl` — they are examples in this doc, not a fixed set.
|
|
35
|
-
|
|
36
|
-
Before any content edit:
|
|
37
|
-
|
|
38
|
-
1. Call `get_site_config` and read **`enabledLanguages`** (array of ISO 639-1 codes) and **`defaultLanguage`**
|
|
39
|
-
2. Use exactly those codes as keys in `content` - and every one of them when adding translations
|
|
40
|
-
3. If the workspace has only one language, content is still keyed by that language code (e.g. `content: { zh: {...} }`), never flat
|
|
41
|
-
|
|
42
|
-
When this rule is violated, you either silently drop a language or write under the wrong key. Both corrupt content.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Rule 1: Always use language-keyed content
|
|
47
|
-
|
|
48
|
-
All block content MUST be keyed by the workspace's enabled language codes (see Rule 0). Examples below show `en` + `pl` purely as an illustration - substitute whatever `enabledLanguages` returns for the actual workspace.
|
|
49
|
-
|
|
50
|
-
```jsonc
|
|
51
|
-
// CORRECT - language-keyed, includes EVERY language the workspace enabled
|
|
52
|
-
// (here en + pl; your workspace might return e.g. ["en","de","zh"] instead)
|
|
53
|
-
{
|
|
54
|
-
"en": { "heading": "Welcome", "subheading": "Hello world" },
|
|
55
|
-
"pl": { "heading": "Witaj", "subheading": "Witaj świecie" }
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// WRONG - flat content, no language keys
|
|
59
|
-
{
|
|
60
|
-
"heading": "Welcome",
|
|
61
|
-
"subheading": "Hello world"
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// WRONG - adding one language without including the others the workspace enabled
|
|
65
|
-
// If enabledLanguages is ["en","pl","de"], you MUST send all three, not just one
|
|
66
|
-
{
|
|
67
|
-
"pl": { "heading": "Witaj" }
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**Critical edge case**: if existing content is flat (no language keys - legacy), you MUST restructure it by providing a key for EVERY enabled language in a single update - the default language gets the existing content, the others get the new translation (or a placeholder copy if the user didn't provide one).
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## Rule 2: Layout blocks (header/footer) follow the same i18n rules
|
|
76
|
-
|
|
77
|
-
Layout blocks (header, footer) live in `layoutBlocks` on a page, not in `blocks`. They use the same `update_block_content` tool and the same language-keyed content structure - with the exact same language codes from `enabledLanguages`.
|
|
78
|
-
|
|
79
|
-
> **Field names are NOT universal - they depend on the workspace's actual header/footer block.** Always inspect the real block with `get_page` before editing. The lists below are the **default cmssy theme**; a custom layout block may use entirely different keys (e.g. `brand`, `links[].label`, `phones[].number`, `email` instead of `navigation[]`/`ctaLabel`/`linkColumns[]`).
|
|
80
|
-
|
|
81
|
-
### Header translatable fields (default theme - verify with `get_page`)
|
|
82
|
-
|
|
83
|
-
- `navigation[].label` - top-level nav labels
|
|
84
|
-
- `navigation[].children[].label` - submenu item labels
|
|
85
|
-
- `navigation[].children[].description` - submenu item descriptions
|
|
86
|
-
- `ctaLabel`, `secondaryCtaLabel` - button labels
|
|
87
|
-
- `announcementText` - announcement bar text
|
|
88
|
-
- `logoutButtonText` - logout button
|
|
89
|
-
|
|
90
|
-
### Footer translatable fields (default theme - verify with `get_page`)
|
|
91
|
-
|
|
92
|
-
- `tagline` - site tagline
|
|
93
|
-
- `linkColumns[].title` - column headings
|
|
94
|
-
- `linkColumns[].links[].name` - link labels
|
|
95
|
-
- `copyrightText` - copyright notice
|
|
96
|
-
|
|
97
|
-
### Non-translatable fields (identical value across all languages)
|
|
98
|
-
|
|
99
|
-
- URLs (`url`, `href`, `ctaUrl`, `announcementLink`)
|
|
100
|
-
- Icons (`icon`)
|
|
101
|
-
- Booleans (`showCta`, `sticky`, `transparent`, `showSocial`)
|
|
102
|
-
- Style values (`announcementBg`, `announcementTextColor`, `logoSize`)
|
|
103
|
-
- `logo` (image URL)
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Rule 3: Workflow for content updates
|
|
108
|
-
|
|
109
|
-
1. **Read first**: Always `get_page` or `get_site_config` before editing
|
|
110
|
-
2. **Read `enabledLanguages`**: Language codes vary per workspace - never hardcode
|
|
111
|
-
3. **Inspect existing content shape**: Is it flat or language-keyed?
|
|
112
|
-
4. **Write every enabled language**: When adding translations, include ALL codes returned by `enabledLanguages`, not just the ones the user mentioned
|
|
113
|
-
5. **Verify**: After update, confirm the response has a key for each enabled language
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## Rule 4: Page blocks vs Layout blocks
|
|
118
|
-
|
|
119
|
-
| | Page blocks | Layout blocks |
|
|
120
|
-
| -------------- | ---------------------------------- | ---------------------------------- |
|
|
121
|
-
| Location | `blocks[]` | `layoutBlocks[]` |
|
|
122
|
-
| Scope | Single page | Inherited across pages |
|
|
123
|
-
| Content | `content[<lang>]` per enabled lang | `content[<lang>]` per enabled lang |
|
|
124
|
-
| Types | hero, features, faq, cta, etc. | header, footer |
|
|
125
|
-
| Position field | No | Yes (`header`, `footer`) |
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## Rule 5: Publishing workflow
|
|
130
|
-
|
|
131
|
-
- `update_block_content` creates unpublished changes (draft)
|
|
132
|
-
- `patch_block_content` does the same via surgical HTML edits (insert_before/insert_after/replace_section) - prefer it for large docs-style content bodies (~10x cheaper, rejects ambiguous/missing markers). Only works on language-keyed content (`content[locale]`); flat content must be restructured with `update_block_content` first.
|
|
133
|
-
- Use `publish_page` to make changes live - it publishes **both content and layout axes** (split per-axis since CMS-628). `hasUnpublishedContentChanges` and `hasUnpublishedLayoutChanges` track the two axes separately.
|
|
134
|
-
- Use `revert_to_published` to discard draft changes
|
|
135
|
-
- Always inform the user about unpublished state after edits
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Rule 6: Available MCP tools quick reference
|
|
140
|
-
|
|
141
|
-
| Tool | Use for |
|
|
142
|
-
| --------------------------------------- | -------------------------------------------------------------------------- |
|
|
143
|
-
| `get_site_config` | **Languages**, site name, features |
|
|
144
|
-
| `get_workspace_info` | Plan, limits, usage |
|
|
145
|
-
| `list_pages` | Browse/search pages |
|
|
146
|
-
| `get_page` | Full page with blocks and content |
|
|
147
|
-
| `create_page` | New page |
|
|
148
|
-
| `update_page_settings` | SEO, displayName, description |
|
|
149
|
-
| `update_block_content` | Edit block content (page or layout) |
|
|
150
|
-
| `patch_block_content` | Surgical HTML edits to a localized content body (insert/replace by marker) |
|
|
151
|
-
| `add_block_to_page` | Add new block |
|
|
152
|
-
| `remove_block_from_page` | Remove block |
|
|
153
|
-
| `update_page_blocks` | Reorder blocks |
|
|
154
|
-
| `update_page_layout` | Change layout blocks |
|
|
155
|
-
| `publish_page` / `unpublish_page` | Publishing |
|
|
156
|
-
| `list_block_types` / `get_block_schema` | Discover available blocks |
|
|
157
|
-
| `list_media` | Browse uploaded media |
|
|
158
|
-
| `list_forms` | Browse forms (filter by status) |
|
|
159
|
-
| `get_form` | Full form with fields, settings, i18n |
|
|
160
|
-
| `create_form` | New form with fields and settings |
|
|
161
|
-
| `update_form` | Edit form name, fields, settings, status |
|
|
162
|
-
| `delete_form` | Delete form and all submissions |
|
|
163
|
-
| `list_form_submissions` | Browse submissions (filter by form/status) |
|
|
164
|
-
| `get_form_submission` | Full submission details |
|
|
165
|
-
| `update_form_submission_status` | Change status (pending/processed/spam/archived) |
|
|
166
|
-
| `delete_form_submission` | Delete a submission |
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## Rule 7: Forms - field types and settings
|
|
171
|
-
|
|
172
|
-
### Available field types (15)
|
|
173
|
-
|
|
174
|
-
`text`, `email`, `password`, `textarea`, `number`, `phone`, `url`, `date`, `datetime`, `select`, `multiselect`, `checkbox`, `radio`, `file`, `hidden`
|
|
175
|
-
|
|
176
|
-
### Action types
|
|
177
|
-
|
|
178
|
-
- `contact` (default) - standard contact form
|
|
179
|
-
- `login` - authentication form
|
|
180
|
-
- `register` - user registration
|
|
181
|
-
- `newsletter` - email subscription
|
|
182
|
-
- `custom` - custom webhook/processing
|
|
183
|
-
|
|
184
|
-
### Form i18n fields (language-keyed, same rules as blocks)
|
|
185
|
-
|
|
186
|
-
All the following fields are keyed by the workspace's `enabledLanguages` codes - whatever the site uses (`en`, `de`, `zh`, …):
|
|
187
|
-
|
|
188
|
-
- `fields[].label`, `fields[].placeholder`, `fields[].helpText`
|
|
189
|
-
- `fields[].options[].label`
|
|
190
|
-
- `settings.submitButtonLabel`, `settings.successMessage`, `settings.errorMessage`
|
|
191
|
-
|
|
192
|
-
### Form statuses
|
|
193
|
-
|
|
194
|
-
- `draft` - not publicly accessible
|
|
195
|
-
- `published` - live and accepting submissions
|
|
196
|
-
- `archived` - disabled
|
|
197
|
-
|
|
198
|
-
### Creating a form example
|
|
199
|
-
|
|
200
|
-
Below: `en` + `pl` shown for illustration. For a workspace with `enabledLanguages: ["en","de","zh"]` you'd send keys `en`, `de`, `zh` instead - always match whatever `get_site_config` returns.
|
|
201
|
-
|
|
202
|
-
```json
|
|
203
|
-
{
|
|
204
|
-
"name": "Contact Form",
|
|
205
|
-
"slug": "contact",
|
|
206
|
-
"fields": [
|
|
207
|
-
{
|
|
208
|
-
"id": "name-field",
|
|
209
|
-
"name": "name",
|
|
210
|
-
"fieldType": "text",
|
|
211
|
-
"label": { "en": "Name", "pl": "Imię" },
|
|
212
|
-
"validation": { "required": true }
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"id": "email-field",
|
|
216
|
-
"name": "email",
|
|
217
|
-
"fieldType": "email",
|
|
218
|
-
"label": { "en": "Email", "pl": "Email" },
|
|
219
|
-
"validation": { "required": true }
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"id": "message-field",
|
|
223
|
-
"name": "message",
|
|
224
|
-
"fieldType": "textarea",
|
|
225
|
-
"label": { "en": "Message", "pl": "Wiadomość" },
|
|
226
|
-
"validation": { "required": true, "minLength": 10 }
|
|
227
|
-
}
|
|
228
|
-
],
|
|
229
|
-
"settings": {
|
|
230
|
-
"actionType": "contact",
|
|
231
|
-
"submitButtonLabel": { "en": "Send", "pl": "Wyślij" },
|
|
232
|
-
"successMessage": { "en": "Thank you!", "pl": "Dziękujemy!" }
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
```
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test helpers for Cmssy blocks.
|
|
3
|
-
* Usage: import { renderBlock } from "@cmssy/cli/test";
|
|
4
|
-
*/
|
|
5
|
-
interface RenderBlockOptions {
|
|
6
|
-
content: Record<string, unknown>;
|
|
7
|
-
context?: Record<string, unknown>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Render a block component with content and optional context.
|
|
11
|
-
* Wraps @testing-library/react render with block-specific props.
|
|
12
|
-
*/
|
|
13
|
-
export declare function renderBlock(Component: any, options: RenderBlockOptions): Promise<any>;
|
|
14
|
-
/**
|
|
15
|
-
* Validate that preview data has required fields present.
|
|
16
|
-
* Does not check value types - only presence of required fields.
|
|
17
|
-
*/
|
|
18
|
-
export declare function validatePreviewData(schema: Record<string, any>, data: Record<string, unknown>): {
|
|
19
|
-
valid: boolean;
|
|
20
|
-
errors: string[];
|
|
21
|
-
};
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-helpers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAOD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,kBAAkB,gBAyB5E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAatC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test helpers for Cmssy blocks.
|
|
3
|
-
* Usage: import { renderBlock } from "@cmssy/cli/test";
|
|
4
|
-
*/
|
|
5
|
-
const DEFAULT_CONTEXT = {
|
|
6
|
-
locale: { current: "en", default: "en", enabled: ["en"] },
|
|
7
|
-
isPreview: true,
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Render a block component with content and optional context.
|
|
11
|
-
* Wraps @testing-library/react render with block-specific props.
|
|
12
|
-
*/
|
|
13
|
-
export async function renderBlock(Component, options) {
|
|
14
|
-
let render;
|
|
15
|
-
try {
|
|
16
|
-
const rtl = await import("@testing-library/react");
|
|
17
|
-
render = rtl.render;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
throw new Error("Missing @testing-library/react. Install it:\n npm install -D @testing-library/react");
|
|
21
|
-
}
|
|
22
|
-
let React;
|
|
23
|
-
try {
|
|
24
|
-
React = await import("react");
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
throw new Error("Missing react. Install it:\n npm install react");
|
|
28
|
-
}
|
|
29
|
-
const context = { ...DEFAULT_CONTEXT, ...options.context };
|
|
30
|
-
const element = React.createElement(Component, {
|
|
31
|
-
content: options.content,
|
|
32
|
-
context,
|
|
33
|
-
});
|
|
34
|
-
return render(element);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Validate that preview data has required fields present.
|
|
38
|
-
* Does not check value types - only presence of required fields.
|
|
39
|
-
*/
|
|
40
|
-
export function validatePreviewData(schema, data) {
|
|
41
|
-
const errors = [];
|
|
42
|
-
for (const [key, field] of Object.entries(schema)) {
|
|
43
|
-
if (field.required &&
|
|
44
|
-
(data[key] === undefined || data[key] === null || data[key] === "")) {
|
|
45
|
-
errors.push(`Required field "${key}" is missing or empty`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return { valid: errors.length === 0, errors };
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=index.js.map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M,CAAC,EAAE,CAAC;QAClD,IACE,KAAK,CAAC,QAAQ;YACd,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EACnE,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for config.ts system.
|
|
3
|
-
* Re-exports from @cmssy/types - the single source of truth.
|
|
4
|
-
*/
|
|
5
|
-
export { FieldType, type FieldConfig, type BaseFieldConfig, type SelectFieldConfig, type MultiselectFieldConfig, type RepeaterFieldConfig, type MediaFieldConfig, type PageSelectorFieldConfig, type FieldValidation, type ValidationPattern, type ShowWhenCondition, type FieldValue, type FieldTypeValueMap, FIELD_TYPE_DEFAULTS, type TypedFieldConfig, type TypedBlockConfig, LayoutPosition, type LayoutOverride, WorkspaceModule, FeatureFlag, type BlockRequires, type BlockConfig, BlockSource, PackageType, type TemplateConfig, type TemplateBlockInstance, type TemplatePageBlueprint, type TemplateLayoutPosition, type TemplateTheme, type ResourceConfig, isTemplateConfig, } from "@cmssy/types";
|
|
6
|
-
//# sourceMappingURL=block-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block-config.d.ts","sourceRoot":"","sources":["../../src/types/block-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAGtB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAGrB,cAAc,EACd,KAAK,cAAc,EAGnB,eAAe,EACf,WAAW,EACX,KAAK,aAAa,EAGlB,KAAK,WAAW,EAChB,WAAW,EACX,WAAW,EAGX,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for config.ts system.
|
|
3
|
-
* Re-exports from @cmssy/types - the single source of truth.
|
|
4
|
-
*/
|
|
5
|
-
export {
|
|
6
|
-
// Field types
|
|
7
|
-
FieldType, FIELD_TYPE_DEFAULTS,
|
|
8
|
-
// Layout
|
|
9
|
-
LayoutPosition,
|
|
10
|
-
// Modules & features
|
|
11
|
-
WorkspaceModule, FeatureFlag, BlockSource, PackageType, isTemplateConfig, } from "@cmssy/types";
|
|
12
|
-
//# sourceMappingURL=block-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block-config.js","sourceRoot":"","sources":["../../src/types/block-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO;AACL,cAAc;AACd,SAAS,EAeT,mBAAmB;AAInB,SAAS;AACT,cAAc;AAGd,qBAAqB;AACrB,eAAe,EACf,WAAW,EAKX,WAAW,EACX,WAAW,EASX,gBAAgB,GACjB,MAAM,cAAc,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export declare const PUBLISH_JOB_STATUS: {
|
|
2
|
-
readonly QUEUED: "queued";
|
|
3
|
-
readonly BUILDING: "building";
|
|
4
|
-
readonly COMPLETED: "completed";
|
|
5
|
-
readonly FAILED: "failed";
|
|
6
|
-
};
|
|
7
|
-
export type PublishJobStatus = (typeof PUBLISH_JOB_STATUS)[keyof typeof PUBLISH_JOB_STATUS];
|
|
8
|
-
export declare const BLOCK_BUILD_STATUS: {
|
|
9
|
-
readonly PENDING: "pending";
|
|
10
|
-
readonly BUILDING: "building";
|
|
11
|
-
readonly PUBLISHED: "published";
|
|
12
|
-
readonly FAILED: "failed";
|
|
13
|
-
};
|
|
14
|
-
export type BlockBuildStatus = (typeof BLOCK_BUILD_STATUS)[keyof typeof BLOCK_BUILD_STATUS];
|
|
15
|
-
export interface PublishJobBlockResult {
|
|
16
|
-
type: string;
|
|
17
|
-
version: string;
|
|
18
|
-
status: BlockBuildStatus | string;
|
|
19
|
-
sourceUrl?: string | null;
|
|
20
|
-
bundleUrls?: {
|
|
21
|
-
server: string;
|
|
22
|
-
client: string;
|
|
23
|
-
styles: string;
|
|
24
|
-
} | null;
|
|
25
|
-
bundleSizes?: {
|
|
26
|
-
server: number;
|
|
27
|
-
client: number;
|
|
28
|
-
styles: number;
|
|
29
|
-
} | null;
|
|
30
|
-
bundleMs?: number | null;
|
|
31
|
-
ssrTestMs?: number | null;
|
|
32
|
-
error?: {
|
|
33
|
-
code: string;
|
|
34
|
-
stage: string;
|
|
35
|
-
message: string;
|
|
36
|
-
} | null;
|
|
37
|
-
}
|
|
38
|
-
export interface PublishJobTimings {
|
|
39
|
-
queuedAt: string;
|
|
40
|
-
buildStartedAt?: string | null;
|
|
41
|
-
buildCompletedAt?: string | null;
|
|
42
|
-
spawnMs?: number | null;
|
|
43
|
-
pnpmInstallMs?: number | null;
|
|
44
|
-
networkLockdownMs?: number | null;
|
|
45
|
-
snapshotMs?: number | null;
|
|
46
|
-
}
|
|
47
|
-
export interface PublishJob {
|
|
48
|
-
id: string;
|
|
49
|
-
workspaceId: string;
|
|
50
|
-
status: PublishJobStatus | string;
|
|
51
|
-
libManifestHash?: string | null;
|
|
52
|
-
snapshotId?: string | null;
|
|
53
|
-
blocks: PublishJobBlockResult[];
|
|
54
|
-
timings: PublishJobTimings;
|
|
55
|
-
error?: {
|
|
56
|
-
code: string;
|
|
57
|
-
stage: string;
|
|
58
|
-
message: string;
|
|
59
|
-
} | null;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=publish-job.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publish-job.d.ts","sourceRoot":"","sources":["../../src/types/publish-job.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACvE,WAAW,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACjE;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACjE"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const PUBLISH_JOB_STATUS = {
|
|
2
|
-
QUEUED: "queued",
|
|
3
|
-
BUILDING: "building",
|
|
4
|
-
COMPLETED: "completed",
|
|
5
|
-
FAILED: "failed",
|
|
6
|
-
};
|
|
7
|
-
export const BLOCK_BUILD_STATUS = {
|
|
8
|
-
PENDING: "pending",
|
|
9
|
-
BUILDING: "building",
|
|
10
|
-
PUBLISHED: "published",
|
|
11
|
-
FAILED: "failed",
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=publish-job.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publish-job.js","sourceRoot":"","sources":["../../src/types/publish-job.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC;AAKX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** True if `error` looks like a client/API schema-version mismatch. */
|
|
2
|
-
export declare function isVersionSkewError(error: unknown): boolean;
|
|
3
|
-
/**
|
|
4
|
-
* Turn a cryptic GraphQL validation error into an actionable CLI/API
|
|
5
|
-
* incompatibility message. Non-skew `Error` instances are returned unchanged;
|
|
6
|
-
* non-skew non-Error throwables are normalized to an `Error` so callers always
|
|
7
|
-
* receive an `Error`.
|
|
8
|
-
*/
|
|
9
|
-
export declare function friendlyApiError(error: unknown): Error;
|
|
10
|
-
//# sourceMappingURL=api-error.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-error.d.ts","sourceRoot":"","sources":["../../src/utils/api-error.ts"],"names":[],"mappings":"AAiBA,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAW1D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAuBtD"}
|
package/dist/utils/api-error.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { CLI_VERSION } from "./version.js";
|
|
2
|
-
/**
|
|
3
|
-
* GraphQL validation-error message fragments that signal the CLI is asking the
|
|
4
|
-
* API for something the API no longer (or doesn't yet) understand - i.e. the
|
|
5
|
-
* client and server schemas have drifted. These are the symptoms we saw when an
|
|
6
|
-
* old CLI hit a newer API ("Unknown type ImportBlockInput", "Cannot query field
|
|
7
|
-
* sourceUrl on type WorkspaceBlock").
|
|
8
|
-
*/
|
|
9
|
-
const SKEW_PATTERNS = [
|
|
10
|
-
/Unknown type/i,
|
|
11
|
-
/Cannot query field/i,
|
|
12
|
-
/Unknown argument/i,
|
|
13
|
-
/Unknown field/i,
|
|
14
|
-
/is not defined by type/i,
|
|
15
|
-
];
|
|
16
|
-
/** True if `error` looks like a client/API schema-version mismatch. */
|
|
17
|
-
export function isVersionSkewError(error) {
|
|
18
|
-
const errs = error?.response?.errors;
|
|
19
|
-
if (!Array.isArray(errs))
|
|
20
|
-
return false;
|
|
21
|
-
return errs.some((e) => {
|
|
22
|
-
const code = e?.extensions?.code;
|
|
23
|
-
const msg = String(e?.message ?? "");
|
|
24
|
-
return ((code === "GRAPHQL_VALIDATION_FAILED" || code === undefined) &&
|
|
25
|
-
SKEW_PATTERNS.some((p) => p.test(msg)));
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Turn a cryptic GraphQL validation error into an actionable CLI/API
|
|
30
|
-
* incompatibility message. Non-skew `Error` instances are returned unchanged;
|
|
31
|
-
* non-skew non-Error throwables are normalized to an `Error` so callers always
|
|
32
|
-
* receive an `Error`.
|
|
33
|
-
*/
|
|
34
|
-
export function friendlyApiError(error) {
|
|
35
|
-
if (!isVersionSkewError(error)) {
|
|
36
|
-
if (error instanceof Error)
|
|
37
|
-
return error;
|
|
38
|
-
// Preserve the raw throwable on `cause` even when normalizing to an Error.
|
|
39
|
-
return new Error(String(error), { cause: error });
|
|
40
|
-
}
|
|
41
|
-
const original = error?.response?.errors?.[0]?.message ??
|
|
42
|
-
error?.message ??
|
|
43
|
-
"GraphQL validation error";
|
|
44
|
-
// `cause` keeps the original throwable (stack / response.errors) for debugging
|
|
45
|
-
// and stack-aware loggers, while the message stays human-friendly.
|
|
46
|
-
return new Error(`The Cmssy API rejected a request this CLI sent (GraphQL validation error).\n` +
|
|
47
|
-
` @cmssy/cli (v${CLI_VERSION}) and the Cmssy API are incompatible -\n` +
|
|
48
|
-
` most often the CLI is out of date. Try upgrading first:\n` +
|
|
49
|
-
` npm i -g @cmssy/cli@latest # if installed globally\n` +
|
|
50
|
-
` # or bump the @cmssy/cli devDependency in your project\n` +
|
|
51
|
-
` If you are already on the latest CLI, the API may be older than this CLI\n` +
|
|
52
|
-
` expects (e.g. a self-hosted or staging backend) - check the API version.\n` +
|
|
53
|
-
` Original error: ${original}`, { cause: error });
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=api-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-error.js","sourceRoot":"","sources":["../../src/utils/api-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,aAAa,GAAa;IAC9B,eAAe;IACf,qBAAqB;IACrB,mBAAmB;IACnB,gBAAgB;IAChB,yBAAyB;CAC1B,CAAC;AAEF,uEAAuE;AACvE,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,MAAM,IAAI,GAAI,KAAa,EAAE,QAAQ,EAAE,MAAM,CAAC;IAC9C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE;QAC1B,MAAM,IAAI,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC;QACjC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;QACrC,OAAO,CACL,CAAC,IAAI,KAAK,2BAA2B,IAAI,IAAI,KAAK,SAAS,CAAC;YAC5D,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CACvC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,IAAI,KAAK,YAAY,KAAK;YAAE,OAAO,KAAK,CAAC;QACzC,2EAA2E;QAC3E,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,QAAQ,GACX,KAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO;QAC7C,KAAa,EAAE,OAAO;QACvB,0BAA0B,CAAC;IAC7B,+EAA+E;IAC/E,mEAAmE;IACnE,OAAO,IAAI,KAAK,CACd,8EAA8E;QAC5E,kBAAkB,WAAW,0CAA0C;QACvE,6DAA6D;QAC7D,iEAAiE;QACjE,8DAA8D;QAC9D,8EAA8E;QAC9E,8EAA8E;QAC9E,qBAAqB,QAAQ,EAAE,EACjC,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import type { FieldType, FieldTypeValueMap, FieldValidation, ShowWhenCondition, TypedFieldConfig } from "@cmssy/types";
|
|
2
|
-
import type { DefineThemeConfig } from "@cmssy/types";
|
|
3
|
-
import { BlockConfig, FieldConfig, ResourceConfig, TemplateConfig, TypedBlockConfig } from "../types/block-config.js";
|
|
4
|
-
declare const __fieldBrand: unique symbol;
|
|
5
|
-
/** Branded field config - must be created via field() helper */
|
|
6
|
-
export type FieldDef = TypedFieldConfig & {
|
|
7
|
-
readonly [__fieldBrand]: true;
|
|
8
|
-
};
|
|
9
|
-
type FieldTypeExtras = {
|
|
10
|
-
select: {
|
|
11
|
-
options: Array<{
|
|
12
|
-
label: string;
|
|
13
|
-
value: string;
|
|
14
|
-
}>;
|
|
15
|
-
};
|
|
16
|
-
multiselect: {
|
|
17
|
-
options: Array<{
|
|
18
|
-
label: string;
|
|
19
|
-
value: string;
|
|
20
|
-
}>;
|
|
21
|
-
};
|
|
22
|
-
numeric: {
|
|
23
|
-
minValue?: number;
|
|
24
|
-
maxValue?: number;
|
|
25
|
-
};
|
|
26
|
-
repeater: {
|
|
27
|
-
minItems?: number;
|
|
28
|
-
maxItems?: number;
|
|
29
|
-
schema: Record<string, FieldDef>;
|
|
30
|
-
};
|
|
31
|
-
media: {
|
|
32
|
-
accept?: string;
|
|
33
|
-
maxSize?: number;
|
|
34
|
-
};
|
|
35
|
-
pageSelector: {
|
|
36
|
-
multiple?: boolean;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
type FieldInputConfig<T extends FieldType> = {
|
|
40
|
-
type: T;
|
|
41
|
-
label: string;
|
|
42
|
-
required?: boolean;
|
|
43
|
-
placeholder?: string;
|
|
44
|
-
defaultValue?: FieldTypeValueMap[T];
|
|
45
|
-
helperText?: string;
|
|
46
|
-
/** @deprecated Use `helperText` instead */
|
|
47
|
-
helpText?: string;
|
|
48
|
-
group?: string;
|
|
49
|
-
showWhen?: ShowWhenCondition;
|
|
50
|
-
validation?: FieldValidation;
|
|
51
|
-
} & (T extends keyof FieldTypeExtras ? FieldTypeExtras[T] : {});
|
|
52
|
-
/**
|
|
53
|
-
* Type-safe field config helper. Required for all schema fields.
|
|
54
|
-
* Infers the field type from `type` and narrows `defaultValue` accordingly.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* field({ type: "singleLine", label: "Title", defaultValue: "Hello" }) // ✓
|
|
58
|
-
* field({ type: "singleLine", label: "Title", defaultValue: 123 }) // ✗ TS error
|
|
59
|
-
*/
|
|
60
|
-
export declare function field<T extends FieldType>(config: FieldInputConfig<T>): FieldDef;
|
|
61
|
-
export declare function defineBlock(config: Omit<TypedBlockConfig, "schema"> & {
|
|
62
|
-
schema: Record<string, FieldDef>;
|
|
63
|
-
/** External package dependencies (e.g., { "framer-motion": "^11.0.0" }) */
|
|
64
|
-
dependencies?: Record<string, string>;
|
|
65
|
-
}): BlockConfig & {
|
|
66
|
-
dependencies?: Record<string, string>;
|
|
67
|
-
};
|
|
68
|
-
export declare function defineTemplate(config: Omit<TemplateConfig, "schema"> & {
|
|
69
|
-
schema?: Record<string, FieldDef>;
|
|
70
|
-
}): TemplateConfig;
|
|
71
|
-
export declare function defineTheme(config: DefineThemeConfig): DefineThemeConfig;
|
|
72
|
-
/**
|
|
73
|
-
* Resolve the config file for a block or template.
|
|
74
|
-
* Both use a unified `config.ts` file.
|
|
75
|
-
*/
|
|
76
|
-
export declare function resolveConfigPath(resourcePath: string): string | null;
|
|
77
|
-
export declare function loadBlockConfig(blockPath: string): Promise<ResourceConfig | null>;
|
|
78
|
-
export declare function validateDefaultValues(schema: Record<string, FieldConfig>): {
|
|
79
|
-
valid: boolean;
|
|
80
|
-
errors: string[];
|
|
81
|
-
};
|
|
82
|
-
export declare function validateSchema(schema: Record<string, FieldConfig>, blockPath: string): Promise<{
|
|
83
|
-
valid: boolean;
|
|
84
|
-
errors: string[];
|
|
85
|
-
}>;
|
|
86
|
-
export {};
|
|
87
|
-
//# sourceMappingURL=block-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block-config.d.ts","sourceRoot":"","sources":["../../src/utils/block-config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACL,WAAW,EACX,WAAW,EAEX,cAAc,EAEd,cAAc,EACd,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAQlC,OAAO,CAAC,MAAM,YAAY,E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