decoupled-cli 2.1.8 → 2.1.9

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 CHANGED
@@ -61,9 +61,10 @@ When this environment variable is set, the CLI will automatically use it for aut
61
61
 
62
62
  **Priority order for authentication:**
63
63
  1. `DECOUPLED_CLI_TOKEN` environment variable (highest priority)
64
- 2. OAuth credentials from `.env.local` (for Drupal content operations)
65
- 3. Stored token in system keychain
66
- 4. Stored token in config file
64
+ 2. Stored token in system keychain
65
+ 3. Stored token in config file
66
+
67
+ **Note:** Content import operations use the same PAT token - no separate OAuth configuration needed!
67
68
 
68
69
  #### Proxy Support
69
70
 
@@ -106,8 +106,8 @@ Your `.env.local` must contain:
106
106
  - `DRUPAL_CLIENT_SECRET=your_oauth_client_secret`
107
107
 
108
108
  **Authentication Method Differences:**
109
- - **OAuth** → Works with your Drupal site API (content import, Drupal operations)
110
- - **Personal Access Token** → Works with Decoupled Drupal platform API (spaces, users, organizations)
109
+ - **Personal Access Token (PAT)** → Works with Decoupled Drupal platform API (spaces, users, organizations, **content import via platform proxy**)
110
+ - **OAuth** → Direct Drupal site API access (alternative method for content import, local development)
111
111
 
112
112
  **If CLI is not available locally:**
113
113
  - For projects with decoupled-cli in package.json: Run `npm install` then use `npx decoupled-cli`
@@ -118,8 +118,8 @@ Your `.env.local` must contain:
118
118
 
119
119
  When asked to create a new content type (e.g., "create a product page"), follow these steps:
120
120
 
121
- **Recommended Workflow (OAuth + Drupal API):**
122
- Use OAuth authentication for direct Drupal content import, then frontend development.
121
+ **Recommended Workflow (PAT + Platform Proxy - Contentful-like simplicity):**
122
+ Use a single PAT token for all operations including content import via the platform proxy.
123
123
 
124
124
  ### 1. Content Analysis & Planning
125
125
 
@@ -134,7 +134,7 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
134
134
  ```markdown
135
135
  1. Verify DC CLI authentication (npx decoupled-cli auth status)
136
136
  2. Create DC Import JSON for [content_type]
137
- 3. Import content type and sample content to Drupal (npx decoupled-cli content import)
137
+ 3. Import content type and sample content via platform (npx decoupled-cli spaces content-import <space_id> --file import.json)
138
138
  4. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
139
139
  5. Create TypeScript types and GraphQL queries
140
140
  6. Build frontend components ([ContentCard], [ContentRenderer])
@@ -143,18 +143,17 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
143
143
  9. Validate end-to-end functionality
144
144
  ```
145
145
 
146
- **Legacy Platform Workflow (PAT + Decoupled Drupal Platform):**
146
+ **Alternative Workflow (OAuth + Direct Drupal API):**
147
147
  ```markdown
148
- 1. Verify DC CLI authentication (npx decoupled-cli auth status)
149
- 2. Set default space if needed (npx decoupled-cli spaces use <id>)
150
- 3. Create DC Import JSON for [content_type]
151
- 4. Import content type and sample content via platform (npx decoupled-cli spaces content-import)
152
- 5. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
153
- 6. Create TypeScript types and GraphQL queries
154
- 7. Build frontend components ([ContentCard], [ContentRenderer])
155
- 8. Create listing and detail pages
156
- 9. Test build process and fix errors
157
- 10. Validate end-to-end functionality
148
+ 1. Set up OAuth authentication (npx decoupled-cli auth oauth)
149
+ 2. Create DC Import JSON for [content_type]
150
+ 3. Import content type and sample content to Drupal directly (npx decoupled-cli content import --file import.json)
151
+ 4. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
152
+ 5. Create TypeScript types and GraphQL queries
153
+ 6. Build frontend components ([ContentCard], [ContentRenderer])
154
+ 7. Create listing and detail pages
155
+ 8. Test build process and fix errors
156
+ 9. Validate end-to-end functionality
158
157
  ```
159
158
 
160
159
  ### 0. CLI Authentication Check
@@ -254,17 +253,23 @@ npx decoupled-cli spaces content-import --example > my-content-type.json
254
253
 
255
254
  ### 3. Import via DC CLI
256
255
 
257
- **Import Content Type:**
256
+ **Import Content Type (Recommended - PAT Only):**
258
257
  ```bash
259
- # NEW: Import content directly to your Drupal site (OAuth authentication)
258
+ # Import via platform proxy using PAT token (Contentful-like simplicity)
259
+ # No OAuth credentials needed - just your PAT token!
260
+ npx decoupled-cli spaces content-import <space_id> --file content-type-import.json
261
+
262
+ # Or let the CLI use your default space
263
+ npx decoupled-cli spaces content-import --file content-type-import.json
264
+ ```
265
+
266
+ **Alternative: Direct Drupal Import (OAuth Required):**
267
+ ```bash
268
+ # Import directly to your Drupal site (requires OAuth authentication)
260
269
  npx decoupled-cli content import --file content-type-import.json
261
270
 
262
271
  # Or preview first to see what will be imported
263
272
  npx decoupled-cli content import --file content-type-import.json --preview
264
-
265
- # LEGACY: Import via Decoupled Drupal platform (requires PAT authentication and space setup)
266
- npx decoupled-cli spaces content-import --file content-type-import.json
267
- npx decoupled-cli spaces content-import <space_id> --file content-type-import.json
268
273
  ```
269
274
 
270
275
  **Generate example import file:**
@@ -818,9 +823,9 @@ npx decoupled-cli content status
818
823
  npx decoupled-cli content import --file your-content.json
819
824
  ```
820
825
 
821
- **When to use OAuth vs PAT:**
822
- - **OAuth**: Local development, direct Drupal operations, content import
823
- - **PAT**: Production deployments, platform management, space operations
826
+ **When to use PAT vs OAuth:**
827
+ - **PAT (Recommended)**: All operations including content import, space management, production deployments - **just like Contentful's CMA token**
828
+ - **OAuth**: Alternative method for direct Drupal API access, local development with existing Drupal credentials
824
829
 
825
830
  ## Best Practices
826
831
 
@@ -106,8 +106,8 @@ Your `.env.local` must contain:
106
106
  - `DRUPAL_CLIENT_SECRET=your_oauth_client_secret`
107
107
 
108
108
  **Authentication Method Differences:**
109
- - **OAuth** → Works with your Drupal site API (content import, Drupal operations)
110
- - **Personal Access Token** → Works with Decoupled Drupal platform API (spaces, users, organizations)
109
+ - **Personal Access Token (PAT)** → Works with Decoupled Drupal platform API (spaces, users, organizations, **content import via platform proxy**)
110
+ - **OAuth** → Direct Drupal site API access (alternative method for content import, local development)
111
111
 
112
112
  **If CLI is not available locally:**
113
113
  - For projects with decoupled-cli in package.json: Run `npm install` then use `npx decoupled-cli`
@@ -118,8 +118,8 @@ Your `.env.local` must contain:
118
118
 
119
119
  When asked to create a new content type (e.g., "create a product page"), follow these steps:
120
120
 
121
- **Recommended Workflow (OAuth + Drupal API):**
122
- Use OAuth authentication for direct Drupal content import, then frontend development.
121
+ **Recommended Workflow (PAT + Platform Proxy - Contentful-like simplicity):**
122
+ Use a single PAT token for all operations including content import via the platform proxy.
123
123
 
124
124
  ### 1. Content Analysis & Planning
125
125
 
@@ -134,7 +134,7 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
134
134
  ```markdown
135
135
  1. Verify DC CLI authentication (npx decoupled-cli auth status)
136
136
  2. Create DC Import JSON for [content_type]
137
- 3. Import content type and sample content to Drupal (npx decoupled-cli content import)
137
+ 3. Import content type and sample content via platform (npx decoupled-cli spaces content-import <space_id> --file import.json)
138
138
  4. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
139
139
  5. Create TypeScript types and GraphQL queries
140
140
  6. Build frontend components ([ContentCard], [ContentRenderer])
@@ -143,18 +143,17 @@ Use OAuth authentication for direct Drupal content import, then frontend develop
143
143
  9. Validate end-to-end functionality
144
144
  ```
145
145
 
146
- **Legacy Platform Workflow (PAT + Decoupled Drupal Platform):**
146
+ **Alternative Workflow (OAuth + Direct Drupal API):**
147
147
  ```markdown
148
- 1. Verify DC CLI authentication (npx decoupled-cli auth status)
149
- 2. Set default space if needed (npx decoupled-cli spaces use <id>)
150
- 3. Create DC Import JSON for [content_type]
151
- 4. Import content type and sample content via platform (npx decoupled-cli spaces content-import)
152
- 5. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
153
- 6. Create TypeScript types and GraphQL queries
154
- 7. Build frontend components ([ContentCard], [ContentRenderer])
155
- 8. Create listing and detail pages
156
- 9. Test build process and fix errors
157
- 10. Validate end-to-end functionality
148
+ 1. Set up OAuth authentication (npx decoupled-cli auth oauth)
149
+ 2. Create DC Import JSON for [content_type]
150
+ 3. Import content type and sample content to Drupal directly (npx decoupled-cli content import --file import.json)
151
+ 4. **CRITICAL**: Run schema generation (`npm run generate-schema`) to update GraphQL schema
152
+ 5. Create TypeScript types and GraphQL queries
153
+ 6. Build frontend components ([ContentCard], [ContentRenderer])
154
+ 7. Create listing and detail pages
155
+ 8. Test build process and fix errors
156
+ 9. Validate end-to-end functionality
158
157
  ```
159
158
 
160
159
  ### 0. CLI Authentication Check
@@ -254,17 +253,23 @@ npx decoupled-cli spaces content-import --example > my-content-type.json
254
253
 
255
254
  ### 3. Import via DC CLI
256
255
 
257
- **Import Content Type:**
256
+ **Import Content Type (Recommended - PAT Only):**
258
257
  ```bash
259
- # NEW: Import content directly to your Drupal site (OAuth authentication)
258
+ # Import via platform proxy using PAT token (Contentful-like simplicity)
259
+ # No OAuth credentials needed - just your PAT token!
260
+ npx decoupled-cli spaces content-import <space_id> --file content-type-import.json
261
+
262
+ # Or let the CLI use your default space
263
+ npx decoupled-cli spaces content-import --file content-type-import.json
264
+ ```
265
+
266
+ **Alternative: Direct Drupal Import (OAuth Required):**
267
+ ```bash
268
+ # Import directly to your Drupal site (requires OAuth authentication)
260
269
  npx decoupled-cli content import --file content-type-import.json
261
270
 
262
271
  # Or preview first to see what will be imported
263
272
  npx decoupled-cli content import --file content-type-import.json --preview
264
-
265
- # LEGACY: Import via Decoupled Drupal platform (requires PAT authentication and space setup)
266
- npx decoupled-cli spaces content-import --file content-type-import.json
267
- npx decoupled-cli spaces content-import <space_id> --file content-type-import.json
268
273
  ```
269
274
 
270
275
  **Generate example import file:**
@@ -822,9 +827,9 @@ npx decoupled-cli content status
822
827
  npx decoupled-cli content import --file your-content.json
823
828
  ```
824
829
 
825
- **When to use OAuth vs PAT:**
826
- - **OAuth**: Local development, direct Drupal operations, content import
827
- - **PAT**: Production deployments, platform management, space operations
830
+ **When to use PAT vs OAuth:**
831
+ - **PAT (Recommended)**: All operations including content import, space management, production deployments - **just like Contentful's CMA token**
832
+ - **OAuth**: Alternative method for direct Drupal API access, local development with existing Drupal credentials
828
833
 
829
834
  ## Best Practices
830
835
 
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "model": [
3
3
  {
4
- "bundle": "article",
4
+ "bundle": "news_article",
5
5
  "description": "Blog articles and news posts with rich media and categorization",
6
- "label": "Article",
6
+ "label": "News Article",
7
7
  "body": true,
8
8
  "fields": [
9
9
  {
10
10
  "id": "summary",
11
11
  "label": "Summary",
12
12
  "type": "string",
13
- "description": "Short text field (max 255 chars) for article preview"
13
+ "description": "Short text field (max 255 chars) for news_article preview"
14
14
  },
15
15
  {
16
16
  "id": "featured_image",
17
17
  "label": "Featured Image",
18
18
  "type": "image",
19
- "description": "Single image upload for article hero"
19
+ "description": "Single image upload for news_article hero"
20
20
  },
21
21
  {
22
22
  "id": "published_date",
@@ -126,11 +126,6 @@
126
126
  "label": "Specifications",
127
127
  "type": "string[]",
128
128
  "description": "Technical specifications"
129
- },
130
- {
131
- "id": "category",
132
- "label": "Product Category",
133
- "type": "term(product_category)[]"
134
129
  }
135
130
  ]
136
131
  }
@@ -141,17 +136,12 @@
141
136
  "type": "paragraph.content_block",
142
137
  "values": {
143
138
  "block_title": "Introduction",
144
- "block_content": "<p>This is an <strong>example content block</strong> with formatted text.</p>",
145
- "block_image": {
146
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
147
- "alt": "Content block illustration",
148
- "title": "Block Image"
149
- }
139
+ "block_content": "<p>This is an <strong>example content block</strong> with formatted text.</p>"
150
140
  }
151
141
  },
152
142
  {
153
143
  "id": "article1",
154
- "type": "node.article",
144
+ "type": "node.news_article",
155
145
  "path": "/articles/getting-started-with-drupal",
156
146
  "values": {
157
147
  "title": "Getting Started with Decoupled Drupal",
@@ -166,23 +156,6 @@
166
156
  "Connect via GraphQL or REST API",
167
157
  "Deploy frontend and backend independently"
168
158
  ],
169
- "featured_image": {
170
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
171
- "alt": "Decoupled Drupal architecture diagram",
172
- "title": "Architecture Overview"
173
- },
174
- "gallery": [
175
- {
176
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
177
- "alt": "Screenshot of content management interface",
178
- "title": "CMS Interface"
179
- },
180
- {
181
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
182
- "alt": "Frontend application example",
183
- "title": "Frontend App"
184
- }
185
- ],
186
159
  "tags": [
187
160
  "drupal",
188
161
  "headless-cms",
@@ -216,22 +189,6 @@
216
189
  "Size: 4 x 4 x 0.5 inches",
217
190
  "Weight: 3.2 oz",
218
191
  "Color: Matte Black"
219
- ],
220
- "product_images": [
221
- {
222
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
223
- "alt": "Wireless Charger Pro front view",
224
- "title": "Product Front"
225
- },
226
- {
227
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
228
- "alt": "Wireless Charger Pro with phone charging",
229
- "title": "In Use"
230
- }
231
- ],
232
- "category": [
233
- "electronics",
234
- "accessories"
235
192
  ]
236
193
  }
237
194
  }
@@ -253,11 +210,11 @@
253
210
  "image_format": {
254
211
  "description": "Images require full URLs with Drupal domain, not relative paths",
255
212
  "example": {
256
- "uri": "${DRUPAL_BASE_URL}/modules/custom/dc_import/resources/placeholder.png",
213
+ "uri": "https://example.com/path/to/image.png",
257
214
  "alt": "Descriptive alt text for accessibility",
258
215
  "title": "Image title"
259
216
  },
260
- "note": "Replace ${DRUPAL_BASE_URL} with actual Drupal URL from .env.local"
217
+ "note": "Use full URLs to publicly accessible images"
261
218
  },
262
219
  "content_references": {
263
220
  "description": "Reference other content items using @id syntax",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decoupled-cli",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "description": "Command-line interface for Decoupled Drupal API management",
5
5
  "main": "dist/index.js",
6
6
  "bin": {