@takeshape/cli 9.13.0 → 9.14.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.
Files changed (184) hide show
  1. package/package.json +14 -9
  2. package/dist/auth.d.ts +0 -5
  3. package/dist/auth.d.ts.map +0 -1
  4. package/dist/auth.js +0 -76
  5. package/dist/check-version.d.ts +0 -2
  6. package/dist/check-version.d.ts.map +0 -1
  7. package/dist/check-version.js +0 -22
  8. package/dist/commands/branch/commands/create.d.ts +0 -2
  9. package/dist/commands/branch/commands/create.d.ts.map +0 -1
  10. package/dist/commands/branch/commands/create.js +0 -67
  11. package/dist/commands/branch/commands/delete.d.ts +0 -2
  12. package/dist/commands/branch/commands/delete.d.ts.map +0 -1
  13. package/dist/commands/branch/commands/delete.js +0 -58
  14. package/dist/commands/branch/commands/list.d.ts +0 -12
  15. package/dist/commands/branch/commands/list.d.ts.map +0 -1
  16. package/dist/commands/branch/commands/list.js +0 -54
  17. package/dist/commands/branch/commands/merge.d.ts +0 -2
  18. package/dist/commands/branch/commands/merge.d.ts.map +0 -1
  19. package/dist/commands/branch/commands/merge.js +0 -158
  20. package/dist/commands/branch/commands/promote.d.ts +0 -2
  21. package/dist/commands/branch/commands/promote.d.ts.map +0 -1
  22. package/dist/commands/branch/commands/promote.js +0 -50
  23. package/dist/commands/branch/commands/tag-version.d.ts +0 -2
  24. package/dist/commands/branch/commands/tag-version.d.ts.map +0 -1
  25. package/dist/commands/branch/commands/tag-version.js +0 -59
  26. package/dist/commands/branch/commands/url.d.ts +0 -3
  27. package/dist/commands/branch/commands/url.d.ts.map +0 -1
  28. package/dist/commands/branch/commands/url.js +0 -84
  29. package/dist/commands/branch/index.d.ts +0 -4
  30. package/dist/commands/branch/index.d.ts.map +0 -1
  31. package/dist/commands/branch/index.js +0 -47
  32. package/dist/commands/build-or-watch.d.ts +0 -4
  33. package/dist/commands/build-or-watch.d.ts.map +0 -1
  34. package/dist/commands/build-or-watch.js +0 -73
  35. package/dist/commands/deploy/index.d.ts +0 -9
  36. package/dist/commands/deploy/index.d.ts.map +0 -1
  37. package/dist/commands/deploy/index.js +0 -74
  38. package/dist/commands/deploy/zip.d.ts +0 -18
  39. package/dist/commands/deploy/zip.d.ts.map +0 -1
  40. package/dist/commands/deploy/zip.js +0 -57
  41. package/dist/commands/export/index.d.ts +0 -4
  42. package/dist/commands/export/index.d.ts.map +0 -1
  43. package/dist/commands/export/index.js +0 -23
  44. package/dist/commands/export/project-export.d.ts +0 -8
  45. package/dist/commands/export/project-export.d.ts.map +0 -1
  46. package/dist/commands/export/project-export.js +0 -109
  47. package/dist/commands/export/schema-export.d.ts +0 -3
  48. package/dist/commands/export/schema-export.d.ts.map +0 -1
  49. package/dist/commands/export/schema-export.js +0 -88
  50. package/dist/commands/import/index.d.ts +0 -4
  51. package/dist/commands/import/index.d.ts.map +0 -1
  52. package/dist/commands/import/index.js +0 -33
  53. package/dist/commands/import/project-import.d.ts +0 -11
  54. package/dist/commands/import/project-import.d.ts.map +0 -1
  55. package/dist/commands/import/project-import.js +0 -198
  56. package/dist/commands/import/roles-import.d.ts +0 -3
  57. package/dist/commands/import/roles-import.d.ts.map +0 -1
  58. package/dist/commands/import/roles-import.js +0 -59
  59. package/dist/commands/import/schema-import.d.ts +0 -3
  60. package/dist/commands/import/schema-import.d.ts.map +0 -1
  61. package/dist/commands/import/schema-import.js +0 -93
  62. package/dist/commands/link.d.ts +0 -3
  63. package/dist/commands/link.d.ts.map +0 -1
  64. package/dist/commands/link.js +0 -63
  65. package/dist/commands/login.d.ts +0 -4
  66. package/dist/commands/login.d.ts.map +0 -1
  67. package/dist/commands/login.js +0 -32
  68. package/dist/commands/logout.d.ts +0 -4
  69. package/dist/commands/logout.d.ts.map +0 -1
  70. package/dist/commands/logout.js +0 -30
  71. package/dist/commands/schema.d.ts +0 -3
  72. package/dist/commands/schema.d.ts.map +0 -1
  73. package/dist/commands/schema.js +0 -25
  74. package/dist/commands/status.d.ts +0 -3
  75. package/dist/commands/status.d.ts.map +0 -1
  76. package/dist/commands/status.js +0 -18
  77. package/dist/commands/types.d.ts +0 -3
  78. package/dist/commands/types.d.ts.map +0 -1
  79. package/dist/commands/types.js +0 -30
  80. package/dist/commands/unlink.d.ts +0 -4
  81. package/dist/commands/unlink.d.ts.map +0 -1
  82. package/dist/commands/unlink.js +0 -30
  83. package/dist/commands/validate.d.ts +0 -4
  84. package/dist/commands/validate.d.ts.map +0 -1
  85. package/dist/commands/validate.js +0 -57
  86. package/dist/config.d.ts +0 -13
  87. package/dist/config.d.ts.map +0 -1
  88. package/dist/config.js +0 -161
  89. package/dist/deprecated.d.ts +0 -2
  90. package/dist/deprecated.d.ts.map +0 -1
  91. package/dist/deprecated.js +0 -9
  92. package/dist/errors.d.ts +0 -7
  93. package/dist/errors.d.ts.map +0 -1
  94. package/dist/errors.js +0 -36
  95. package/dist/files.d.ts +0 -4
  96. package/dist/files.d.ts.map +0 -1
  97. package/dist/files.js +0 -56
  98. package/dist/graphql.d.ts +0 -22
  99. package/dist/graphql.d.ts.map +0 -1
  100. package/dist/graphql.js +0 -104
  101. package/dist/index.d.ts +0 -3
  102. package/dist/index.d.ts.map +0 -1
  103. package/dist/index.js +0 -128
  104. package/dist/log.d.ts +0 -4
  105. package/dist/log.d.ts.map +0 -1
  106. package/dist/log.js +0 -21
  107. package/dist/main.d.ts +0 -2
  108. package/dist/main.d.ts.map +0 -1
  109. package/dist/main.js +0 -40
  110. package/dist/options.d.ts +0 -102
  111. package/dist/options.d.ts.map +0 -1
  112. package/dist/options.js +0 -103
  113. package/dist/prompt.d.ts +0 -11
  114. package/dist/prompt.d.ts.map +0 -1
  115. package/dist/prompt.js +0 -39
  116. package/dist/types.d.ts +0 -47
  117. package/dist/types.d.ts.map +0 -1
  118. package/dist/types.js +0 -20
  119. package/dist/util/api.d.ts +0 -5
  120. package/dist/util/api.d.ts.map +0 -1
  121. package/dist/util/api.js +0 -76
  122. package/dist/util/branches.d.ts +0 -18
  123. package/dist/util/branches.d.ts.map +0 -1
  124. package/dist/util/branches.js +0 -77
  125. package/dist/util/cached-connector.d.ts +0 -5
  126. package/dist/util/cached-connector.d.ts.map +0 -1
  127. package/dist/util/cached-connector.js +0 -34
  128. package/dist/util/connector.d.ts +0 -8
  129. package/dist/util/connector.d.ts.map +0 -1
  130. package/dist/util/connector.js +0 -19
  131. package/dist/util/data.d.ts +0 -39
  132. package/dist/util/data.d.ts.map +0 -1
  133. package/dist/util/data.js +0 -165
  134. package/dist/util/fatal-error.d.ts +0 -2
  135. package/dist/util/fatal-error.d.ts.map +0 -1
  136. package/dist/util/fatal-error.js +0 -17
  137. package/dist/util/format-error.d.ts +0 -2
  138. package/dist/util/format-error.d.ts.map +0 -1
  139. package/dist/util/format-error.js +0 -10
  140. package/dist/util/format-validation-result.d.ts +0 -3
  141. package/dist/util/format-validation-result.d.ts.map +0 -1
  142. package/dist/util/format-validation-result.js +0 -17
  143. package/dist/util/fs.d.ts +0 -5
  144. package/dist/util/fs.d.ts.map +0 -1
  145. package/dist/util/fs.js +0 -42
  146. package/dist/util/generate-types.d.ts +0 -5
  147. package/dist/util/generate-types.d.ts.map +0 -1
  148. package/dist/util/generate-types.js +0 -63
  149. package/dist/util/get-client-schema.d.ts +0 -5
  150. package/dist/util/get-client-schema.d.ts.map +0 -1
  151. package/dist/util/get-client-schema.js +0 -31
  152. package/dist/util/glitch.d.ts +0 -5
  153. package/dist/util/glitch.d.ts.map +0 -1
  154. package/dist/util/glitch.js +0 -51
  155. package/dist/util/linked-command.d.ts +0 -5
  156. package/dist/util/linked-command.d.ts.map +0 -1
  157. package/dist/util/linked-command.js +0 -48
  158. package/dist/util/login.d.ts +0 -21
  159. package/dist/util/login.d.ts.map +0 -1
  160. package/dist/util/login.js +0 -141
  161. package/dist/util/messages.d.ts +0 -13
  162. package/dist/util/messages.d.ts.map +0 -1
  163. package/dist/util/messages.js +0 -60
  164. package/dist/util/ora-wrapper.d.ts +0 -2
  165. package/dist/util/ora-wrapper.d.ts.map +0 -1
  166. package/dist/util/ora-wrapper.js +0 -28
  167. package/dist/util/pusher.d.ts +0 -10
  168. package/dist/util/pusher.d.ts.map +0 -1
  169. package/dist/util/pusher.js +0 -34
  170. package/dist/util/runner.d.ts +0 -2
  171. package/dist/util/runner.d.ts.map +0 -1
  172. package/dist/util/runner.js +0 -46
  173. package/dist/util/select-project.d.ts +0 -4
  174. package/dist/util/select-project.d.ts.map +0 -1
  175. package/dist/util/select-project.js +0 -23
  176. package/dist/util/spin.d.ts +0 -7
  177. package/dist/util/spin.d.ts.map +0 -1
  178. package/dist/util/spin.js +0 -41
  179. package/dist/util/upload.d.ts +0 -5
  180. package/dist/util/upload.d.ts.map +0 -1
  181. package/dist/util/upload.js +0 -55
  182. package/dist/util/watcher.d.ts +0 -2
  183. package/dist/util/watcher.d.ts.map +0 -1
  184. package/dist/util/watcher.js +0 -30
package/dist/index.js DELETED
@@ -1,128 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- var _meow = _interopRequireDefault(require("meow"));
5
-
6
- var _main = _interopRequireDefault(require("./main"));
7
-
8
- var _config = require("./config");
9
-
10
- var _checkVersion = require("./check-version");
11
-
12
- var _options = require("./options");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- const help = `
17
- Usage
18
- $ takeshape <comand>
19
-
20
- Commands
21
- login
22
- logout
23
- link
24
- unlink
25
- branch
26
- build
27
- watch
28
- schema
29
- types
30
- status
31
- import
32
- export
33
- validate
34
-
35
- branch Subcommands
36
- list list all branches
37
- create create a branch
38
- delete delete a branch
39
- promote promote a branch to production and delete that branch
40
- versionUrl get the hashed url pinned to a version the GraphQL API
41
- url get the url to the GraphQL API
42
- tagVersion tag a schema version — if no --hash is provided it will tag
43
- the latest version this command is idempotent — if you run
44
- it multiple time with the same tag and no hash specified it
45
- will return the versioned API URL for the existing tag and
46
- will not create a new one
47
- merge merge two branches and place the output in a target branch —
48
- 'branch merge --head my_branch' will use my_branch as a merge
49
- head, the branch's parent as a base, and the parent as a target.
50
- This typically means your merge will be compared to production
51
- and merged into production.
52
-
53
-
54
- Examples
55
- $ takeshape build --file path/to/tsg.yml
56
- $ takeshape branch list
57
- $ takeshape branch create --name my-feature
58
- $ takeshape branch delete --name my-feature
59
- $ takeshape branch promote --name my-feature
60
- $ takeshape branch url --production
61
- $ takeshape branch tagVersion --name my-feature --tag my-tag
62
- $ takeshape brance merge --head my-feature
63
-
64
- Options
65
- --token, -t TakeShape API auth token
66
- --cliLogin, -l Log in using CLI (do not open browser)
67
- --site, -s TakeShape static site id
68
- --file, -f path to tsg.yml
69
- --output, -o build output path
70
- --endpoint, -e endpoint
71
- --version, -v version number
72
- --cache -c use file cache (default false)
73
- --watchContent, -W rebuild on content change (watch only)
74
-
75
- branch Options
76
- One of
77
- --production specify the production environment, when using this branch name not allowed
78
- --development specify the development environment, this is the default when --branch is specified
79
- --scratch specify the scratch environment
80
-
81
- Only for the tagVersion and url commands
82
- --tag tag to apply to a branch version
83
- --hash (optional) which version to hash — if not specified will tag the latest
84
-
85
- Only for the merge command — base and target are optional
86
- --head a development branch name to use as the head. Use this
87
- flag alone for a smart merge with the branch parent.
88
- --base the development branch name or 'production' to use for the base
89
- --target the development branch name to 'production' to use for the target
90
-
91
- --branch use with non-branch commands to specify the branch name, required when using --development
92
- --name use with branch commands to specify the branch name, required when using --development
93
-
94
- import Options
95
- One of
96
- --project import a takeshape project from given directory, zip or url
97
- --schema import a takeshape schema from a directory or JSON file to the currently linked project
98
- --roles import roles from a directory or JSON file to the currently linked project
99
-
100
- --from specifies the file, directory, zip or url to import (required)
101
- --to either "new-project" or "current-project" (default "new-project")
102
- --name for use with --project specifies a new name for the imported project
103
- --preserveAuth do not overwrite service authentication
104
- --tag apply a tag to the imported version
105
-
106
- export Options
107
- One of
108
- --schema export a takeshape schema from a directory or JSON file
109
- --project export a takeshape project zip
110
-
111
- --to specifies the directory to write the exported data to (required)
112
- --withoutData when using --project skip exporting the data
113
-
114
- validate Options
115
- --path path to the schema file to validate, or the directory it is in (default "./schema.json")
116
-
117
- Examples
118
- $ takeshape build --file path/to/tsg.yml
119
- $ takeshape branch list
120
- $ takeshape branch create --name my-feature
121
- $ takeshape branch delete --name my-feature
122
- $ takeshape branch url --production
123
-
124
- `;
125
- const cli = (0, _meow.default)(help, _options.options);
126
- const cwd = process.cwd();
127
- (0, _checkVersion.checkVersion)(process.version);
128
- void (0, _main.default)(cli, (0, _config.loadConfig)(cwd, cli));
package/dist/log.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare function log(...args: any): void;
2
- export declare function logError(...args: any): void;
3
- export default log;
4
- //# sourceMappingURL=log.d.ts.map
package/dist/log.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAAA,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,IAAI,CAGtC;AAED,wBAAgB,QAAQ,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,IAAI,CAG3C;AAED,eAAe,GAAG,CAAC"}
package/dist/log.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- exports.log = log;
8
- exports.logError = logError;
9
-
10
- function log(...args) {
11
- // eslint-disable-next-line no-console
12
- console.log.apply(null, args);
13
- }
14
-
15
- function logError(...args) {
16
- // eslint-disable-next-line no-console
17
- console.error.apply(null, args);
18
- }
19
-
20
- var _default = log;
21
- exports.default = _default;
package/dist/main.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export default function _default(cli: any, params: any): Promise<void>;
2
- //# sourceMappingURL=main.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.js"],"names":[],"mappings":"AAmBA,uEASC"}
package/dist/main.js DELETED
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = _default;
7
-
8
- var _log = _interopRequireDefault(require("./log"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- const commandPath = {
13
- build: 'build-or-watch',
14
- watch: 'build-or-watch',
15
- login: 'login',
16
- logout: 'logout',
17
- link: 'link',
18
- unlink: 'unlink',
19
- deploy: 'deploy',
20
- schema: 'schema',
21
- types: 'types',
22
- status: 'status',
23
- import: 'import',
24
- export: 'export',
25
- validate: 'validate',
26
- branch: 'branch'
27
- };
28
-
29
- async function _default(cli, params) {
30
- const command = cli.input[0];
31
- const path = commandPath[command];
32
-
33
- if (path) {
34
- const fn = require(`./commands/${path}`).default;
35
-
36
- await fn(cli, params);
37
- } else {
38
- (0, _log.default)('No such command:' + cli.help);
39
- }
40
- }
package/dist/options.d.ts DELETED
@@ -1,102 +0,0 @@
1
- import { Result } from 'meow';
2
- export declare const options: {
3
- readonly flags: {
4
- readonly token: {
5
- readonly type: "string";
6
- readonly alias: "t";
7
- };
8
- readonly cliLogin: {
9
- readonly type: "boolean";
10
- readonly alias: "l";
11
- };
12
- readonly site: {
13
- readonly type: "string";
14
- readonly alias: "s";
15
- };
16
- readonly file: {
17
- readonly type: "string";
18
- readonly alias: "f";
19
- };
20
- readonly output: {
21
- readonly type: "string";
22
- readonly alias: "o";
23
- };
24
- readonly endpoint: {
25
- readonly type: "string";
26
- readonly alias: "e";
27
- };
28
- readonly version: {
29
- readonly alias: "v";
30
- };
31
- readonly cache: {
32
- readonly type: "boolean";
33
- readonly alias: "c";
34
- };
35
- readonly watchContent: {
36
- readonly type: "boolean";
37
- readonly alias: "W";
38
- };
39
- readonly path: {
40
- readonly type: "string";
41
- };
42
- readonly to: {
43
- readonly type: "string";
44
- };
45
- readonly from: {
46
- readonly type: "string";
47
- };
48
- readonly schema: {
49
- readonly type: "boolean";
50
- };
51
- readonly roles: {
52
- readonly type: "boolean";
53
- };
54
- readonly name: {
55
- readonly type: "string";
56
- };
57
- readonly withoutData: {
58
- readonly type: "boolean";
59
- };
60
- readonly branch: {
61
- readonly type: "string";
62
- };
63
- readonly production: {
64
- readonly type: "boolean";
65
- };
66
- readonly development: {
67
- readonly type: "boolean";
68
- };
69
- readonly scratch: {
70
- readonly type: "boolean";
71
- };
72
- readonly preserveAuth: {
73
- readonly type: "boolean";
74
- };
75
- readonly tag: {
76
- readonly type: "string";
77
- };
78
- readonly hash: {
79
- readonly type: "string";
80
- };
81
- readonly dryRun: {
82
- readonly type: "boolean";
83
- };
84
- readonly deleteMergedBranch: {
85
- readonly type: "boolean";
86
- };
87
- readonly head: {
88
- readonly type: "string";
89
- };
90
- readonly base: {
91
- readonly type: "string";
92
- };
93
- readonly target: {
94
- readonly type: "string";
95
- };
96
- };
97
- };
98
- export declare type Flags = typeof options.flags;
99
- export declare type Cli = Pick<Result<Flags>, 'input'> & {
100
- flags: Partial<Result<Flags>['flags']>;
101
- };
102
- //# sourceMappingURL=options.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,MAAM,CAAC;AAE5B,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+FV,CAAC;AAEX,oBAAY,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,CAAC;AACzC,oBAAY,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,GAAG;IAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;CAAC,CAAC"}
package/dist/options.js DELETED
@@ -1,103 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.options = void 0;
7
- const options = {
8
- flags: {
9
- token: {
10
- type: 'string',
11
- alias: 't'
12
- },
13
- cliLogin: {
14
- type: 'boolean',
15
- alias: 'l'
16
- },
17
- site: {
18
- type: 'string',
19
- alias: 's'
20
- },
21
- file: {
22
- type: 'string',
23
- alias: 'f'
24
- },
25
- output: {
26
- type: 'string',
27
- alias: 'o'
28
- },
29
- endpoint: {
30
- type: 'string',
31
- alias: 'e'
32
- },
33
- version: {
34
- alias: 'v'
35
- },
36
- cache: {
37
- type: 'boolean',
38
- alias: 'c'
39
- },
40
- watchContent: {
41
- type: 'boolean',
42
- alias: 'W'
43
- },
44
- path: {
45
- type: 'string'
46
- },
47
- to: {
48
- type: 'string'
49
- },
50
- from: {
51
- type: 'string'
52
- },
53
- schema: {
54
- type: 'boolean'
55
- },
56
- roles: {
57
- type: 'boolean'
58
- },
59
- name: {
60
- type: 'string'
61
- },
62
- withoutData: {
63
- type: 'boolean'
64
- },
65
- branch: {
66
- type: 'string'
67
- },
68
- production: {
69
- type: 'boolean'
70
- },
71
- development: {
72
- type: 'boolean'
73
- },
74
- scratch: {
75
- type: 'boolean'
76
- },
77
- preserveAuth: {
78
- type: 'boolean'
79
- },
80
- tag: {
81
- type: 'string'
82
- },
83
- hash: {
84
- type: 'string'
85
- },
86
- dryRun: {
87
- type: 'boolean'
88
- },
89
- deleteMergedBranch: {
90
- type: 'boolean'
91
- },
92
- head: {
93
- type: 'string'
94
- },
95
- base: {
96
- type: 'string'
97
- },
98
- target: {
99
- type: 'string'
100
- }
101
- }
102
- };
103
- exports.options = options;
package/dist/prompt.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import inquirer, { QuestionCollection } from 'inquirer';
2
- export declare function prompt(options: QuestionCollection): Promise<inquirer.Answers> & {
3
- ui: import("inquirer/lib/ui/prompt");
4
- };
5
- export declare function confirm(message: string): Promise<boolean>;
6
- export interface Choice {
7
- name: string;
8
- value: string;
9
- }
10
- export declare function promptList(message: string, choices: Choice[]): Promise<Choice>;
11
- //# sourceMappingURL=prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAEtD,wBAAgB,MAAM,CAAC,OAAO,EAAE,kBAAkB;;EAEjD;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ/D;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CASpF"}
package/dist/prompt.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.confirm = confirm;
7
- exports.prompt = prompt;
8
- exports.promptList = promptList;
9
-
10
- var _inquirer = _interopRequireDefault(require("inquirer"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- function prompt(options) {
15
- return _inquirer.default.prompt(options);
16
- }
17
-
18
- async function confirm(message) {
19
- const {
20
- isConfirmed
21
- } = await prompt({
22
- type: 'confirm',
23
- name: 'isConfirmed',
24
- message
25
- });
26
- return isConfirmed;
27
- }
28
-
29
- async function promptList(message, choices) {
30
- const {
31
- id
32
- } = await prompt({
33
- type: 'list',
34
- name: 'id',
35
- message,
36
- choices
37
- });
38
- return choices.find(choice => choice.value === id);
39
- }
package/dist/types.d.ts DELETED
@@ -1,47 +0,0 @@
1
- import type { ApiKey } from './util/data';
2
- import type { Cli } from './options';
3
- export declare type Handler = (cli: Cli, params: CliConfig) => Promise<void>;
4
- export interface CliConfig {
5
- buildPath: string;
6
- configFilePath: string;
7
- appUrl: string;
8
- endpoint: string;
9
- authToken?: string;
10
- personalAccessTokenId?: string;
11
- linkedApiKey?: ApiKey;
12
- cliLogin?: boolean;
13
- siteId?: string;
14
- projectName?: string;
15
- projectId?: string;
16
- siteName?: string;
17
- cache: boolean;
18
- watchContent: boolean;
19
- }
20
- export declare type AuthedHandler = (cli: Cli, params: LoggedInCliConfig) => Promise<void>;
21
- export declare type LinkedHandler = (cli: Cli, params: LinkedCliConfig) => Promise<void>;
22
- export declare type LoggedInAndLinkedHandler = (cli: Cli, params: LoggedInAndLinkedConfig) => Promise<void>;
23
- export interface LoggedInCliConfig extends CliConfig {
24
- authToken: string;
25
- personalAccessTokenId?: string;
26
- }
27
- export interface LinkedCliConfig extends CliConfig {
28
- projectId: string;
29
- linkedApiKey: ApiKey;
30
- }
31
- export declare type LoggedInAndLinkedConfig = LoggedInCliConfig & LinkedCliConfig;
32
- export declare function isLinkedCliConfig(cliConfig: CliConfig): cliConfig is LinkedCliConfig;
33
- export declare function isLoggedInCliConfig(cliConfig: CliConfig): cliConfig is LoggedInCliConfig;
34
- export declare function isLoggedInAndLinkedConfig(cliConfig: CliConfig): cliConfig is LoggedInAndLinkedConfig;
35
- export interface GraphQLRequestParams {
36
- query: string;
37
- variables?: Record<string, unknown>;
38
- }
39
- export interface GraphQLResponse {
40
- data: any;
41
- errors?: GraphQLError[];
42
- }
43
- export interface GraphQLError {
44
- message: string;
45
- }
46
- export declare type Client = (params: GraphQLRequestParams) => Promise<GraphQLResponse>;
47
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,WAAW,CAAC;AAEnC,oBAAY,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAErE,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,oBAAY,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AACnF,oBAAY,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AACjF,oBAAY,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpG,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,oBAAY,uBAAuB,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAE1E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,IAAI,eAAe,CAEpF;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,IAAI,iBAAiB,CAExF;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,IAAI,uBAAuB,CAEpG;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oBAAY,MAAM,GAAG,CAAC,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC"}
package/dist/types.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isLinkedCliConfig = isLinkedCliConfig;
7
- exports.isLoggedInAndLinkedConfig = isLoggedInAndLinkedConfig;
8
- exports.isLoggedInCliConfig = isLoggedInCliConfig;
9
-
10
- function isLinkedCliConfig(cliConfig) {
11
- return cliConfig.projectId !== undefined && cliConfig.linkedApiKey !== undefined;
12
- }
13
-
14
- function isLoggedInCliConfig(cliConfig) {
15
- return cliConfig.authToken !== undefined;
16
- }
17
-
18
- function isLoggedInAndLinkedConfig(cliConfig) {
19
- return isLinkedCliConfig(cliConfig) && isLoggedInCliConfig(cliConfig);
20
- }
@@ -1,5 +0,0 @@
1
- import { CliConfig } from '../types';
2
- export declare function isJWT(str: string): boolean;
3
- export declare function getAuthHeader(authToken?: string): Record<string, string>;
4
- export default function api(params: CliConfig, method: string, path: string, body?: any): Promise<any>;
5
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/util/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAanC,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG1C;AAED,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxE;AAED,wBAA8B,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CA6B3G"}
package/dist/util/api.js DELETED
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = api;
7
- exports.getAuthHeader = getAuthHeader;
8
- exports.isJWT = isJWT;
9
-
10
- var _nodeFetch = _interopRequireDefault(require("node-fetch"));
11
-
12
- var _errors = require("../errors");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- function isValidHeader(str) {
17
- const json = Buffer.from(str, 'base64').toString('utf8');
18
-
19
- try {
20
- const header = JSON.parse(json);
21
- return header.typ === 'JWT';
22
- } catch {
23
- return false;
24
- }
25
- }
26
-
27
- function isJWT(str) {
28
- const parts = str.split('.');
29
- return parts.length === 3 && isValidHeader(parts[0]);
30
- }
31
-
32
- function getAuthHeader(authToken) {
33
- if (!authToken) {
34
- return {};
35
- }
36
-
37
- return isJWT(authToken) ? {
38
- 'X-TakeShape-Token': authToken
39
- } : {
40
- Authorization: `Bearer ${authToken}`
41
- };
42
- }
43
-
44
- async function api(params, method, path, body) {
45
- var _params$linkedApiKey;
46
-
47
- const requestParams = {
48
- method,
49
- headers: { ...getAuthHeader(params.authToken ?? ((_params$linkedApiKey = params.linkedApiKey) === null || _params$linkedApiKey === void 0 ? void 0 : _params$linkedApiKey.apiKey)),
50
- 'Content-Type': 'application/json'
51
- }
52
- };
53
-
54
- if (body) {
55
- requestParams.body = JSON.stringify(body);
56
- }
57
-
58
- const endpoint = `${params.endpoint}${path}`;
59
- const res = await (0, _nodeFetch.default)(endpoint, requestParams);
60
-
61
- if (res.ok) {
62
- const contentLengthHeader = res.headers.get('content-length');
63
-
64
- if (contentLengthHeader !== null) {
65
- const contentLength = parseInt(contentLengthHeader, 10);
66
-
67
- if (contentLength === 0) {
68
- return;
69
- }
70
- }
71
-
72
- return res.json();
73
- }
74
-
75
- throw new _errors.HTTPError(`${res.statusText}`, res.status);
76
- }
@@ -1,18 +0,0 @@
1
- import { Cli } from '../options';
2
- import { BRANCH_ENVIRONMENT_PRODUCTION_ENUM, BRANCH_ENVIRONMENT_DEVELOPMENT_ENUM, BRANCH_ENVIRONMENT_SCRATCH_ENUM } from '@takeshape/branches';
3
- export declare type BranchFlag = 'branch' | 'name';
4
- export declare type Environment = typeof BRANCH_ENVIRONMENT_PRODUCTION_ENUM | typeof BRANCH_ENVIRONMENT_DEVELOPMENT_ENUM | typeof BRANCH_ENVIRONMENT_SCRATCH_ENUM;
5
- export declare function getEnvironment(cli: Cli, flag?: BranchFlag): Environment;
6
- export declare function isEnvironment(environment: string): environment is Environment;
7
- export declare type BranchArgs = {
8
- environment: Environment;
9
- branchName?: string;
10
- };
11
- export declare function getBranchArgs(name: string): BranchArgs;
12
- export interface BranchParams {
13
- environment: Environment;
14
- branch?: string;
15
- }
16
- export declare function getBranchParams(cli: Cli, flag?: BranchFlag): BranchParams;
17
- export declare function getBranchBasePath({ environment, branch }: BranchParams, projectId: string): string;
18
- //# sourceMappingURL=branches.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"branches.d.ts","sourceRoot":"","sources":["../../../src/util/branches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AAG/B,OAAO,EAEL,kCAAkC,EAClC,mCAAmC,EACnC,+BAA+B,EAChC,MAAM,qBAAqB,CAAC;AAE7B,oBAAY,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE3C,oBAAY,WAAW,GACnB,OAAO,kCAAkC,GACzC,OAAO,mCAAmC,GAC1C,OAAO,+BAA+B,CAAC;AAE3C,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,GAAE,UAAqB,GAAG,WAAW,CAcjF;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,IAAI,WAAW,CAM7E;AAED,oBAAY,UAAU,GAAG;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAWtD;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,GAAE,UAAqB,GAAG,YAAY,CAanF;AAED,wBAAgB,iBAAiB,CAAC,EAAC,WAAW,EAAE,MAAM,EAAC,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGhG"}