decoupled-cli 2.8.0 → 2.9.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/examples/FORMAT-REFERENCE.md +204 -0
- package/package.json +1 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Content Import JSON Format Reference
|
|
2
|
+
|
|
3
|
+
## ⚠️ CRITICAL FORMAT REQUIREMENTS
|
|
4
|
+
|
|
5
|
+
When importing content via the `import_content` MCP tool or API, you MUST use this exact format:
|
|
6
|
+
|
|
7
|
+
### Model Array Format
|
|
8
|
+
|
|
9
|
+
**✅ CORRECT:**
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"model": [
|
|
13
|
+
{
|
|
14
|
+
"bundle": "article", // ✓ Use "bundle" key (NOT "type")
|
|
15
|
+
"label": "Article",
|
|
16
|
+
"description": "News articles",
|
|
17
|
+
"fields": [
|
|
18
|
+
{
|
|
19
|
+
"id": "summary", // ✓ Use "id" for field machine name
|
|
20
|
+
"type": "text",
|
|
21
|
+
"label": "Summary"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**❌ WRONG:**
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"model": [
|
|
33
|
+
{
|
|
34
|
+
"type": "article", // ❌ WRONG - will cause NULL ID error
|
|
35
|
+
"label": "Article",
|
|
36
|
+
"fields": [
|
|
37
|
+
{
|
|
38
|
+
"name": "summary", // ❌ Use "id" not "name"
|
|
39
|
+
"type": "text"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Content Array Format
|
|
48
|
+
|
|
49
|
+
**✅ CORRECT:**
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"content": [
|
|
53
|
+
{
|
|
54
|
+
"type": "node.article", // ✓ Format: "node.bundle_name"
|
|
55
|
+
"id": "article1", // ✓ Required unique ID
|
|
56
|
+
"values": { // ✓ Wrap fields in "values" object
|
|
57
|
+
"title": "My First Article",
|
|
58
|
+
"summary": "This is a summary"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**❌ WRONG:**
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"content": [
|
|
69
|
+
{
|
|
70
|
+
"type": "article", // ❌ Missing "node." prefix
|
|
71
|
+
"title": "My Article", // ❌ Fields not wrapped in "values"
|
|
72
|
+
"summary": "Summary"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Complete Working Example
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"model": [
|
|
83
|
+
{
|
|
84
|
+
"bundle": "blog_post",
|
|
85
|
+
"label": "Blog Post",
|
|
86
|
+
"description": "Blog articles with author and date",
|
|
87
|
+
"fields": [
|
|
88
|
+
{
|
|
89
|
+
"id": "author",
|
|
90
|
+
"type": "string",
|
|
91
|
+
"label": "Author Name"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"id": "published_date",
|
|
95
|
+
"type": "datetime",
|
|
96
|
+
"label": "Published Date"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "content",
|
|
100
|
+
"type": "text",
|
|
101
|
+
"label": "Post Content"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"content": [
|
|
107
|
+
{
|
|
108
|
+
"type": "node.blog_post",
|
|
109
|
+
"id": "post1",
|
|
110
|
+
"values": {
|
|
111
|
+
"title": "Welcome to My Blog",
|
|
112
|
+
"author": "John Doe",
|
|
113
|
+
"published_date": "2026-01-19",
|
|
114
|
+
"content": "This is my first blog post!"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"type": "node.blog_post",
|
|
119
|
+
"id": "post2",
|
|
120
|
+
"values": {
|
|
121
|
+
"title": "Getting Started with Drupal",
|
|
122
|
+
"author": "Jane Smith",
|
|
123
|
+
"published_date": "2026-01-20",
|
|
124
|
+
"content": "Drupal is a powerful CMS..."
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Field Types Reference
|
|
132
|
+
|
|
133
|
+
Common field types you can use in the `"type"` field:
|
|
134
|
+
|
|
135
|
+
- `"string"` - Short text (max 255 chars)
|
|
136
|
+
- `"text"` - Long text with HTML formatting
|
|
137
|
+
- `"datetime"` - Date and time (ISO 8601 format: "2026-01-19")
|
|
138
|
+
- `"bool"` - Boolean true/false
|
|
139
|
+
- `"image"` - Single image upload
|
|
140
|
+
- `"image[]"` - Multiple images
|
|
141
|
+
- `"string[]"` - Multiple string values
|
|
142
|
+
- `"term(vocabulary_name)[]"` - Taxonomy term references
|
|
143
|
+
- `"paragraph(bundle_name)[]"` - Paragraph entity references
|
|
144
|
+
|
|
145
|
+
## Common Errors and Fixes
|
|
146
|
+
|
|
147
|
+
### Error: "Cannot load the node_type entity with NULL ID"
|
|
148
|
+
|
|
149
|
+
**Cause:** Model uses `"type"` instead of `"bundle"`
|
|
150
|
+
|
|
151
|
+
**Fix:**
|
|
152
|
+
```json
|
|
153
|
+
// ❌ Wrong
|
|
154
|
+
{"model": [{"type": "article", ...}]}
|
|
155
|
+
|
|
156
|
+
// ✅ Correct
|
|
157
|
+
{"model": [{"bundle": "article", ...}]}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Error: "Failed to authenticate with Drupal site"
|
|
161
|
+
|
|
162
|
+
**Actual Cause:** This error message is misleading - it usually means your JSON format is wrong, not an authentication issue.
|
|
163
|
+
|
|
164
|
+
**Fix:** Check that:
|
|
165
|
+
1. Model uses `"bundle"` key
|
|
166
|
+
2. Content uses `"type": "node.bundle_name"` format
|
|
167
|
+
3. Content has `"id"` and `"values"` wrapper
|
|
168
|
+
|
|
169
|
+
## Entity Types
|
|
170
|
+
|
|
171
|
+
### Nodes (Default)
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"model": [{"bundle": "article", "label": "Article", "fields": [...]}],
|
|
175
|
+
"content": [{"type": "node.article", "id": "a1", "values": {...}}]
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Paragraphs
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"model": [
|
|
183
|
+
{
|
|
184
|
+
"entity": "paragraph", // ✓ Specify entity type
|
|
185
|
+
"bundle": "text_block",
|
|
186
|
+
"label": "Text Block",
|
|
187
|
+
"fields": [...]
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
"content": [
|
|
191
|
+
{
|
|
192
|
+
"type": "paragraph.text_block", // ✓ Format: "paragraph.bundle"
|
|
193
|
+
"id": "block1",
|
|
194
|
+
"values": {...}
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## See Also
|
|
201
|
+
|
|
202
|
+
- `cli/examples/content-import-sample.json` - Comprehensive field type examples
|
|
203
|
+
- `cli/examples/church-starter.json` - Real-world church website example
|
|
204
|
+
- `cli/examples/helloworld-import.json` - Simple getting started example
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decoupled-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Command-line interface for managing Decoupled Drupal spaces, deploying content, and automating workflows. Features content import, space management, and CI/CD integration.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|