@marvalt/wadapter 2.0.1 → 2.3.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 CHANGED
@@ -52,19 +52,7 @@ class WordPressClient {
52
52
  'Content-Type': 'application/json',
53
53
  };
54
54
  // Add authentication based on mode
55
- if (this.config.authMode === 'cloudflare_proxy') {
56
- // Add Cloudflare proxy authentication headers
57
- if (this.config.appId) {
58
- headers['x-app-id'] = this.config.appId;
59
- }
60
- if (this.config.workerSecret) {
61
- headers['x-app-secret'] = this.config.workerSecret;
62
- }
63
- if (this.config.cfAccessClientId && this.config.cfAccessClientSecret) {
64
- headers['CF-Access-Client-Id'] = this.config.cfAccessClientId;
65
- headers['CF-Access-Client-Secret'] = this.config.cfAccessClientSecret;
66
- }
67
- }
55
+ if (this.config.authMode === 'cloudflare_proxy') ;
68
56
  else {
69
57
  // Direct mode - use basic auth
70
58
  if (this.config.username && this.config.password) {
@@ -298,19 +286,7 @@ class GravityFormsClient {
298
286
  ...options.headers,
299
287
  };
300
288
  // Add authentication based on mode
301
- if (this.config.authMode === 'cloudflare_proxy') {
302
- // Add Cloudflare proxy authentication headers
303
- if (this.config.appId) {
304
- headers['x-app-id'] = this.config.appId;
305
- }
306
- if (this.config.workerSecret) {
307
- headers['x-app-secret'] = this.config.workerSecret;
308
- }
309
- if (this.config.cfAccessClientId && this.config.cfAccessClientSecret) {
310
- headers['CF-Access-Client-Id'] = this.config.cfAccessClientId;
311
- headers['CF-Access-Client-Secret'] = this.config.cfAccessClientSecret;
312
- }
313
- }
289
+ if (this.config.authMode === 'cloudflare_proxy') ;
314
290
  else {
315
291
  // Direct mode - use basic auth
316
292
  if (this.config.username && this.config.password) {
@@ -2333,11 +2309,12 @@ class WordPressGenerator {
2333
2309
  const frontendId = this.config.frontendId || 'default-frontend';
2334
2310
  const frontendName = this.config.frontendName || 'Default Frontend';
2335
2311
  const postTypes = this.config.postTypes || ['posts', 'pages', 'case_studies', 'projects', 'members', 'testimonial', 'faqs', 'products', 'services', 'events'];
2312
+ // Use 'edit' context only when credentials are provided; otherwise fall back to 'view'
2313
+ const hasBasicAuth = !!(this.config.username && this.config.password);
2336
2314
  const data = await client.getAllData({
2337
2315
  per_page: this.config.maxItems || 100,
2338
2316
  _embed: this.config.includeEmbedded || false,
2339
- // required for content.raw with Gutenberg comments
2340
- context: 'edit',
2317
+ context: hasBasicAuth ? 'edit' : 'view',
2341
2318
  });
2342
2319
  // Create the static data structure matching the existing format
2343
2320
  const staticData = {