dbdocs 0.8.3 → 0.8.5

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/bin/run CHANGED
File without changes
@@ -1 +1 @@
1
- {"version":"0.8.3","commands":{"build":{"id":"build","description":"build docs","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","description":"project name","multiple":false},"public":{"name":"public","type":"boolean","description":"anyone with the URL can access","helpGroup":"sharing","allowNo":false,"exclusive":["private","password"]},"private":{"name":"private","type":"boolean","description":"only invited people can access","helpGroup":"sharing","allowNo":false,"exclusive":["public","password"]},"password":{"name":"password","type":"option","char":"p","description":"anyone with the URL + password can access","helpGroup":"sharing","multiple":false,"exclusive":["public","private"]}},"args":[{"name":"filepath","description":"dbml file path"}]},"login":{"id":"login","description":"login to dbdocs\nlogin with your dbdocs credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"logout":{"id":"logout","description":"logout\nclears local login credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"ls":{"id":"ls","description":"list projects","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"password":{"id":"password","description":"set password for your project or remove password","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"project name","helpValue":"project name","multiple":false},"set":{"name":"set","type":"option","char":"s","description":"password for your project","helpValue":"password","multiple":false},"remove":{"name":"remove","type":"boolean","char":"r","description":"remove password from your project","allowNo":false}},"args":[]},"remove":{"id":"remove","description":"remove project","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"project_name","description":"name of the project which you want to remove"}]},"rename":{"id":"rename","description":"change your username","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"token":{"id":"token","description":"generate or revoke your authentication token","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"generate":{"name":"generate","type":"boolean","char":"g","description":"generate authentication token","allowNo":false},"revoke":{"name":"revoke","type":"boolean","char":"r","description":"revoke authentication token","allowNo":false}},"args":[]},"validate":{"id":"validate","description":"validate docs content","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"filepath","description":"dbml file path"}]}}}
1
+ {"version":"0.8.5","commands":{"build":{"id":"build","description":"build docs","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","description":"project name","multiple":false},"public":{"name":"public","type":"boolean","description":"anyone with the URL can access","helpGroup":"sharing","allowNo":false,"exclusive":["private","password"]},"private":{"name":"private","type":"boolean","description":"only invited people can access","helpGroup":"sharing","allowNo":false,"exclusive":["public","password"]},"password":{"name":"password","type":"option","char":"p","description":"anyone with the URL + password can access","helpGroup":"sharing","multiple":false,"exclusive":["public","private"]}},"args":[{"name":"filepath","description":"dbml file path"}]},"login":{"id":"login","description":"login to dbdocs\nlogin with your dbdocs credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"logout":{"id":"logout","description":"logout\nclears local login credentials\n","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"ls":{"id":"ls","description":"list projects","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"password":{"id":"password","description":"set password for your project or remove password","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"project":{"name":"project","type":"option","char":"p","description":"project name","helpValue":"project name","multiple":false},"set":{"name":"set","type":"option","char":"s","description":"password for your project","helpValue":"password","multiple":false},"remove":{"name":"remove","type":"boolean","char":"r","description":"remove password from your project","allowNo":false}},"args":[]},"remove":{"id":"remove","description":"remove project","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"project_name","description":"name of the project which you want to remove"}]},"rename":{"id":"rename","description":"change your username","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[]},"token":{"id":"token","description":"generate or revoke your authentication token","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{"generate":{"name":"generate","type":"boolean","char":"g","description":"generate authentication token","allowNo":false},"revoke":{"name":"revoke","type":"boolean","char":"r","description":"revoke authentication token","allowNo":false}},"args":[]},"validate":{"id":"validate","description":"validate docs content","strict":true,"pluginName":"dbdocs","pluginAlias":"dbdocs","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"filepath","description":"dbml file path"}]}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbdocs",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "author": "@holistics",
5
5
  "bin": {
6
6
  "dbdocs": "./bin/run"
@@ -12,7 +12,7 @@
12
12
  "@dbml/core": "^2.6.0",
13
13
  "@oclif/core": "1.12.1",
14
14
  "@oclif/plugin-help": "5.1.12",
15
- "axios": "0.27.2",
15
+ "axios": "1.6.0",
16
16
  "chalk": "^3.0.0",
17
17
  "dotenv": "^8.2.0",
18
18
  "inquirer": "^7.0.1",
@@ -13,6 +13,7 @@ const { shouldAskForFeedback } = require('../utils/feedback');
13
13
  const { isValidName } = require('../validators/projectName');
14
14
  const parse = require('../utils/parse');
15
15
  const { PROJECT_GENERAL_ACCESS_TYPE, FLAG_HELP_GROUP } = require('../utils/constants');
16
+ const { getProjectUrl } = require('../utils/helper');
16
17
  const { getIsPublicValueFromBuildFlag } = require('../utils/helper');
17
18
 
18
19
  async function build (project, authConfig) {
@@ -106,7 +107,7 @@ class BuildCommand extends Command {
106
107
  default:
107
108
  break;
108
109
  }
109
- spinner.succeed(`Done. Visit: ${chalk.cyan(`${vars.hostUrl}/${newProject.org.name}/${newProject.urlName}`)}\n`);
110
+ spinner.succeed(`Done. Visit: ${chalk.cyan(getProjectUrl(vars.hostUrl, newProject.org.name, newProject.urlName))}\n`);
110
111
  if (shouldAskForFeedback()) {
111
112
  spinner.info(`Thanks for using dbdocs! We'd love to hear your feedback: ${chalk.cyan('https://form.jotform.com/200962053361448')}`);
112
113
  }
@@ -116,6 +117,8 @@ class BuildCommand extends Command {
116
117
  const { error } = err.response.data;
117
118
  if (error.name === 'SyntaxError') {
118
119
  message = `You have syntax error in ${path.basename(filepath)} line ${error.location.start.line} column ${error.location.start.column}. ${error.message}`;
120
+ } else if (error.name === 'AccessDenied') {
121
+ message = error.message;
119
122
  }
120
123
  }
121
124
  throw new Error(message);
@@ -5,6 +5,7 @@ const verifyToken = require('../utils/verifyToken');
5
5
  const { getProjectsByOrg } = require('../utils/org');
6
6
  const { getOrg } = require('../utils/org');
7
7
  const { PROJECT_SHARING_TEXT } = require('../utils/constants');
8
+ const { getProjectUrl } = require('../utils/helper');
8
9
 
9
10
  class LsCommand extends Command {
10
11
  async run () {
@@ -15,7 +16,7 @@ class LsCommand extends Command {
15
16
  this.log(chalk.bold(org.name));
16
17
 
17
18
  const [maxUrlWidth, maxUpdatedAtWidth] = projects.reduce((accumulator, project) => {
18
- const url = `${vars.hostUrl}/${org.name}/${project.urlName}`;
19
+ const url = getProjectUrl(vars.hostUrl, org.name, project.urlName);
19
20
  const updatedAt = (new Date(project.updatedAt)).toLocaleString();
20
21
  return [
21
22
  accumulator[0] > url.length ? accumulator[0] : url.length,
@@ -33,7 +34,7 @@ class LsCommand extends Command {
33
34
  },
34
35
  url: {
35
36
  minWidth: maxUrlWidth + 2,
36
- get: (project) => chalk.cyan(`${vars.hostUrl}/${org.name}/${project.urlName}`),
37
+ get: (project) => chalk.cyan(getProjectUrl(vars.hostUrl, org.name, project.urlName)),
37
38
  },
38
39
  updatedAt: {
39
40
  minWidth: maxUpdatedAtWidth + 2,
@@ -3,7 +3,9 @@ const getIsPublicValueFromBuildFlag = (publicFlag, privateFlag, passwordFlag) =>
3
3
  if (privateFlag) return false;
4
4
  return undefined; // 'undefined' means keep the old `isPublic` state
5
5
  };
6
+ const getProjectUrl = (hostUrl, orgName, projectUrl) => `${hostUrl}/${encodeURIComponent(orgName)}/${projectUrl}`;
6
7
 
7
8
  module.exports = {
8
9
  getIsPublicValueFromBuildFlag,
10
+ getProjectUrl,
9
11
  };