confluence-cli 2.0.0 → 2.0.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/lib/config.js CHANGED
@@ -257,7 +257,7 @@ function saveConfigFile(data) {
257
257
  const validateCliOptions = (options) => {
258
258
  const errors = [];
259
259
 
260
- if (options.domain && !options.domain.trim()) {
260
+ if (options.domain && (typeof options.domain !== 'string' || !options.domain.trim())) {
261
261
  errors.push('--domain cannot be empty');
262
262
  }
263
263
 
@@ -265,12 +265,12 @@ const validateCliOptions = (options) => {
265
265
  errors.push('--token cannot be empty');
266
266
  }
267
267
 
268
- if (options.email && !options.email.trim()) {
268
+ if (options.email && (typeof options.email !== 'string' || !options.email.trim())) {
269
269
  errors.push('--email cannot be empty');
270
270
  }
271
271
 
272
272
  if (options.apiPath) {
273
- if (!options.apiPath.startsWith('/')) {
273
+ if (typeof options.apiPath !== 'string' || !options.apiPath.startsWith('/')) {
274
274
  errors.push('--api-path must start with "/"');
275
275
  } else {
276
276
  // Validate API path format
@@ -282,16 +282,18 @@ const validateCliOptions = (options) => {
282
282
  }
283
283
  }
284
284
 
285
- if (options.protocol && !['http', 'https'].includes(options.protocol.toLowerCase())) {
285
+ if (options.protocol && (typeof options.protocol !== 'string' || !['http', 'https'].includes(options.protocol.toLowerCase()))) {
286
286
  errors.push('--protocol must be "http" or "https"');
287
287
  }
288
288
 
289
- if (options.authType && !AUTH_TYPES.includes(options.authType.toLowerCase())) {
289
+ if (options.authType && (typeof options.authType !== 'string' || !AUTH_TYPES.includes(options.authType.toLowerCase()))) {
290
290
  errors.push('--auth-type must be "basic", "bearer", "mtls", or "cookie"');
291
291
  }
292
292
 
293
293
  // Check if basic auth is provided with email
294
- const normAuthType = options.authType ? normalizeAuthType(options.authType, Boolean(options.email)) : null;
294
+ const normAuthType = (typeof options.authType === 'string' && options.authType)
295
+ ? normalizeAuthType(options.authType, Boolean(options.email))
296
+ : null;
295
297
  if (normAuthType === 'basic' && !options.email) {
296
298
  errors.push('--email is required when using basic authentication (use your username for on-premise)');
297
299
  }
@@ -512,7 +514,9 @@ async function initConfig(cliOptions = {}) {
512
514
  protocol: cliOptions.protocol,
513
515
  domain: cliOptions.domain,
514
516
  apiPath: cliOptions.apiPath,
515
- authType: cliOptions.authType ? cliOptions.authType.trim().toLowerCase() : undefined,
517
+ authType: (typeof cliOptions.authType === 'string' && cliOptions.authType)
518
+ ? cliOptions.authType.trim().toLowerCase()
519
+ : cliOptions.authType,
516
520
  email: cliOptions.email,
517
521
  token: cliOptions.token,
518
522
  cookie: cliOptions.cookie,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "confluence-cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "confluence-cli",
9
- "version": "2.0.0",
9
+ "version": "2.0.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "axios": "^1.15.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "confluence-cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "A command-line interface for Atlassian Confluence with page creation and editing capabilities",
5
5
  "main": "index.js",
6
6
  "bin": {