@takeshape/cli 8.239.0 → 8.241.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/commands/branch/commands/create.d.ts +2 -0
- package/dist/commands/branch/commands/create.d.ts.map +1 -0
- package/dist/commands/branch/commands/create.js +63 -0
- package/dist/commands/branch/commands/delete.d.ts +2 -0
- package/dist/commands/branch/commands/delete.d.ts.map +1 -0
- package/dist/commands/branch/commands/delete.js +50 -0
- package/dist/commands/branch/commands/list.d.ts +12 -0
- package/dist/commands/branch/commands/list.d.ts.map +1 -0
- package/dist/commands/branch/commands/list.js +54 -0
- package/dist/commands/branch/commands/url.d.ts +3 -0
- package/dist/commands/branch/commands/url.d.ts.map +1 -0
- package/dist/commands/branch/commands/url.js +44 -0
- package/dist/commands/branch/index.d.ts +4 -0
- package/dist/commands/branch/index.d.ts.map +1 -0
- package/dist/commands/branch/index.js +38 -0
- package/dist/commands/build-or-watch.d.ts +1 -1
- package/dist/commands/build-or-watch.d.ts.map +1 -1
- package/dist/commands/build-or-watch.js +7 -3
- package/dist/commands/deploy/index.d.ts +1 -1
- package/dist/commands/export/index.d.ts +1 -3
- package/dist/commands/export/index.d.ts.map +1 -1
- package/dist/commands/export/index.js +4 -4
- package/dist/commands/export/project-export.d.ts +1 -6
- package/dist/commands/export/project-export.d.ts.map +1 -1
- package/dist/commands/export/project-export.js +4 -1
- package/dist/commands/export/schema-export.d.ts +1 -5
- package/dist/commands/export/schema-export.d.ts.map +1 -1
- package/dist/commands/export/schema-export.js +8 -2
- package/dist/commands/import/index.d.ts +1 -4
- package/dist/commands/import/index.d.ts.map +1 -1
- package/dist/commands/import/index.js +10 -6
- package/dist/commands/import/project-import.d.ts +1 -7
- package/dist/commands/import/project-import.d.ts.map +1 -1
- package/dist/commands/import/project-import.js +5 -2
- package/dist/commands/import/roles-import.d.ts +1 -5
- package/dist/commands/import/roles-import.d.ts.map +1 -1
- package/dist/commands/import/roles-import.js +10 -2
- package/dist/commands/import/schema-import.d.ts +1 -5
- package/dist/commands/import/schema-import.d.ts.map +1 -1
- package/dist/commands/import/schema-import.js +10 -2
- package/dist/commands/link.d.ts +1 -1
- package/dist/commands/login.d.ts +3 -3
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +2 -1
- package/dist/commands/logout.d.ts +3 -3
- package/dist/commands/logout.d.ts.map +1 -1
- package/dist/commands/logout.js +2 -1
- package/dist/commands/schema.d.ts +1 -1
- package/dist/commands/schema.d.ts.map +1 -1
- package/dist/commands/schema.js +5 -3
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/types.d.ts +1 -4
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +4 -4
- package/dist/commands/unlink.d.ts +3 -3
- package/dist/commands/unlink.d.ts.map +1 -1
- package/dist/commands/unlink.js +2 -1
- package/dist/commands/validate.d.ts +3 -6
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +5 -1
- package/dist/config.js +2 -0
- package/dist/graphql.d.ts +12 -4
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +15 -7
- package/dist/index.js +32 -42
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +5 -3
- package/dist/options.d.ts +78 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +79 -0
- package/dist/types.d.ts +6 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/util/branches.d.ts +10 -0
- package/dist/util/branches.d.ts.map +1 -0
- package/dist/util/branches.js +56 -0
- package/dist/util/connector.d.ts +2 -1
- package/dist/util/connector.d.ts.map +1 -1
- package/dist/util/connector.js +4 -4
- package/dist/util/data.d.ts +4 -3
- package/dist/util/data.d.ts.map +1 -1
- package/dist/util/data.js +6 -6
- package/dist/util/linked-command.d.ts +4 -3
- package/dist/util/linked-command.d.ts.map +1 -1
- package/dist/util/linked-command.js +28 -13
- package/package.json +8 -5
|
@@ -23,6 +23,8 @@ var _formatValidationResult = require("../../util/format-validation-result");
|
|
|
23
23
|
|
|
24
24
|
var _fs = require("../../util/fs");
|
|
25
25
|
|
|
26
|
+
var _branches = require("../../util/branches");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
/*
|
|
@@ -33,7 +35,10 @@ Replace your project's schema by uploading a new one
|
|
|
33
35
|
Flags:
|
|
34
36
|
--from Directory containing a schema.json or path to schema.json file
|
|
35
37
|
*/
|
|
36
|
-
var _default = (0, _linkedCommand.linkedCommand)(async (
|
|
38
|
+
var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
|
|
39
|
+
const {
|
|
40
|
+
flags
|
|
41
|
+
} = cli;
|
|
37
42
|
const {
|
|
38
43
|
projectId
|
|
39
44
|
} = params;
|
|
@@ -51,6 +56,8 @@ var _default = (0, _linkedCommand.linkedCommand)(async (_, params, flags) => {
|
|
|
51
56
|
return (0, _fatalError.fatalError)(`Schema file does not exist: ${file}`);
|
|
52
57
|
}
|
|
53
58
|
|
|
59
|
+
const branchParams = (0, _branches.getBranchParams)(cli);
|
|
60
|
+
|
|
54
61
|
try {
|
|
55
62
|
const newSchema = JSON.parse(_fsExtra.default.readFileSync(file).toString());
|
|
56
63
|
const validationString = (0, _formatValidationResult.formatValidationResult)((0, _schema.validateSchema)(newSchema));
|
|
@@ -60,7 +67,8 @@ var _default = (0, _linkedCommand.linkedCommand)(async (_, params, flags) => {
|
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
(0, _log.default)(`Uploading schema from ${file}…\n`);
|
|
63
|
-
const
|
|
70
|
+
const schemaImportPath = `${(0, _branches.getBranchBasePath)(branchParams, projectId)}/schema?force=true`;
|
|
71
|
+
const uploaded = await (0, _api.default)(params, 'POST', schemaImportPath, newSchema);
|
|
64
72
|
(0, _log.default)(_chalk.default.green('Success!'), `Schema updated to version ${uploaded.version}.`);
|
|
65
73
|
process.exit(0);
|
|
66
74
|
} catch (e) {
|
package/dist/commands/link.d.ts
CHANGED
package/dist/commands/login.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
1
|
+
import { Handler } from '../types';
|
|
2
|
+
declare const login: Handler;
|
|
3
|
+
export default login;
|
|
4
4
|
//# sourceMappingURL=login.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/login.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/login.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAIjC,QAAA,MAAM,KAAK,EAAE,OAWZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/dist/commands/login.js
CHANGED
|
@@ -15,7 +15,7 @@ var _data = require("../util/data");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const login = async (_, params) => {
|
|
19
19
|
try {
|
|
20
20
|
const userJwt = await (params.cliLogin ? (0, _login.loginCli)(params, 3) : (0, _login.loginBrowser)(params));
|
|
21
21
|
|
|
@@ -28,4 +28,5 @@ var _default = async (_, params) => {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
var _default = login;
|
|
31
32
|
exports.default = _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
1
|
+
import { Handler } from '../types';
|
|
2
|
+
declare const logout: Handler;
|
|
3
|
+
export default logout;
|
|
4
4
|
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/commands/logout.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/commands/logout.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAsB,MAAM,UAAU,CAAC;AAItD,QAAA,MAAM,MAAM,EAAE,OASb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/commands/logout.js
CHANGED
|
@@ -15,7 +15,7 @@ var _data = require("../util/data");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const logout = async (_, params) => {
|
|
19
19
|
try {
|
|
20
20
|
if ((0, _types.isLoggedInCliConfig)(params)) {
|
|
21
21
|
await (0, _data.deletePersonalAccessToken)(params);
|
|
@@ -26,4 +26,5 @@ var _default = async (_, params) => {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
var _default = logout;
|
|
29
30
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/commands/schema.
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/commands/schema.ts"],"names":[],"mappings":";AAKA,wBAGG"}
|
package/dist/commands/schema.js
CHANGED
|
@@ -11,13 +11,15 @@ var _connector = require("../util/connector");
|
|
|
11
11
|
|
|
12
12
|
var _getClientSchema = _interopRequireDefault(require("../util/get-client-schema"));
|
|
13
13
|
|
|
14
|
+
var _branches = require("../util/branches");
|
|
15
|
+
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
|
-
var _default = (0, _linkedCommand.linkedCommand)((
|
|
17
|
-
const connector = (0, _connector.createConnector)(params, {
|
|
18
|
+
var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
|
|
19
|
+
const connector = (0, _connector.createConnector)(params, (0, _branches.getBranchParams)(cli), {
|
|
18
20
|
cache: false
|
|
19
21
|
});
|
|
20
|
-
(0, _getClientSchema.default)(connector);
|
|
22
|
+
await (0, _getClientSchema.default)(connector);
|
|
21
23
|
});
|
|
22
24
|
|
|
23
25
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":";AAGA,wBAEG"}
|
package/dist/commands/status.js
CHANGED
|
@@ -11,7 +11,7 @@ var _log = _interopRequireDefault(require("../log"));
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
var _default = (0, _linkedCommand.linkedCommand)((
|
|
14
|
+
var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
|
|
15
15
|
(0, _log.default)(`Project: ${params.projectName} \nStatic Site: ${params.siteName ?? 'not configured'}`);
|
|
16
16
|
});
|
|
17
17
|
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/types.ts"],"names":[],"mappings":";AAeA,wBAGG"}
|
package/dist/commands/types.js
CHANGED
|
@@ -18,13 +18,13 @@ takeshape types --to ./takeshape.d.ts
|
|
|
18
18
|
Generate TypeScript types from your TakeShape schema.
|
|
19
19
|
|
|
20
20
|
Options:
|
|
21
|
-
--in: if provided, will generate types used
|
|
21
|
+
--in: if provided, will generate types used
|
|
22
22
|
--to: the path to save the download or the full file path, defaults to current directory
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
var _default = (0, _linkedCommand.linkedCommand)(async
|
|
26
|
-
const output = flags.to ?? DEFAULT_GENERATED_FILE;
|
|
27
|
-
|
|
25
|
+
var _default = (0, _linkedCommand.linkedCommand)(async cli => {
|
|
26
|
+
const output = cli.flags.to ?? DEFAULT_GENERATED_FILE;
|
|
27
|
+
await (0, _generateTypes.generateTypes)(_getClientSchema.SCHEMA_FILE_NAME, output);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
exports.default = _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
1
|
+
import { Handler } from '../types';
|
|
2
|
+
declare const unlink: Handler;
|
|
3
|
+
export default unlink;
|
|
4
4
|
//# sourceMappingURL=unlink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unlink.d.ts","sourceRoot":"","sources":["../../../src/commands/unlink.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"unlink.d.ts","sourceRoot":"","sources":["../../../src/commands/unlink.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAA4B,MAAM,UAAU,CAAC;AAI5D,QAAA,MAAM,MAAM,EAAE,OASb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/commands/unlink.js
CHANGED
|
@@ -15,7 +15,7 @@ var _data = require("../util/data");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const unlink = async (_, params) => {
|
|
19
19
|
try {
|
|
20
20
|
if ((0, _types.isLoggedInAndLinkedConfig)(params)) {
|
|
21
21
|
await (0, _data.deleteApiKey)(params, params.projectId, params.linkedApiKey.id);
|
|
@@ -26,4 +26,5 @@ var _default = async (_, params) => {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
var _default = unlink;
|
|
29
30
|
exports.default = _default;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
declare const _default: (_command: string, _params: CliConfig, flags: ValidateFlags) => Promise<void>;
|
|
6
|
-
export default _default;
|
|
1
|
+
import { Handler } from '../types';
|
|
2
|
+
declare const validate: Handler;
|
|
3
|
+
export default validate;
|
|
7
4
|
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/validate.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAEjC,QAAA,MAAM,QAAQ,EAAE,OA+Bf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -19,7 +19,10 @@ var _schema = require("@takeshape/schema");
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const validate = async cli => {
|
|
23
|
+
const {
|
|
24
|
+
flags
|
|
25
|
+
} = cli;
|
|
23
26
|
let schemaPath;
|
|
24
27
|
|
|
25
28
|
if (flags.path) {
|
|
@@ -50,4 +53,5 @@ var _default = async (_command, _params, flags) => {
|
|
|
50
53
|
(0, _log.default)(`${schemaPath} is valid.`);
|
|
51
54
|
};
|
|
52
55
|
|
|
56
|
+
var _default = validate;
|
|
53
57
|
exports.default = _default;
|
package/dist/config.js
CHANGED
|
@@ -129,6 +129,8 @@ async function writeLinkedProjectConfig(params, linkedApiKey, project, site) {
|
|
|
129
129
|
};
|
|
130
130
|
await Promise.all([_fsExtra.default.writeJSON(GRAPHQL_CONFIG_FILENAME, graphqlConfigJson), _fsExtra.default.writeJSON(TAKESHAPE_CONFIG_FILENAME, takeshaperc), (0, _getClientSchema.default)((0, _connector.createConnector)({ ...params,
|
|
131
131
|
...takeshaperc
|
|
132
|
+
}, {
|
|
133
|
+
environment: 'PRODUCTION'
|
|
132
134
|
}, {
|
|
133
135
|
cache: false
|
|
134
136
|
}))]);
|
package/dist/graphql.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { Client, CliConfig } from './types';
|
|
2
|
-
|
|
2
|
+
import { BranchParams } from './util/branches';
|
|
3
|
+
export declare type PathParams = (BranchParams & {
|
|
4
|
+
projectId?: string;
|
|
5
|
+
}) | string | undefined;
|
|
6
|
+
export declare type ProjectPathParams = (PathParams & {
|
|
7
|
+
projectId: string;
|
|
8
|
+
}) | string;
|
|
9
|
+
export declare type GetGraphQLEndpoint = (params: CliConfig, pathParams: PathParams) => string;
|
|
3
10
|
export declare const getGraphQLEndpoint: GetGraphQLEndpoint;
|
|
4
11
|
export declare const getGraphQLAdminEndpoint: GetGraphQLEndpoint;
|
|
5
12
|
export interface GraphQLConnectorOptions {
|
|
6
13
|
retries?: number;
|
|
7
14
|
timeout?: number;
|
|
8
15
|
cache?: boolean;
|
|
16
|
+
branch?: BranchParams;
|
|
9
17
|
}
|
|
10
|
-
export declare const createConnectorFactory: (getGraphQLEndpoint: GetGraphQLEndpoint) => (params: CliConfig, authToken: string,
|
|
11
|
-
export declare const createConnector: (params: CliConfig, authToken: string,
|
|
12
|
-
export declare const createAdminConnector: (params: CliConfig, authToken: string,
|
|
18
|
+
export declare const createConnectorFactory: (getGraphQLEndpoint: GetGraphQLEndpoint) => (params: CliConfig, authToken: string, pathParams?: PathParams, options?: GraphQLConnectorOptions | undefined) => Client;
|
|
19
|
+
export declare const createConnector: (params: CliConfig, authToken: string, pathParams?: PathParams, options?: GraphQLConnectorOptions | undefined) => Client;
|
|
20
|
+
export declare const createAdminConnector: (params: CliConfig, authToken: string, pathParams?: PathParams, options?: GraphQLConnectorOptions | undefined) => Client;
|
|
13
21
|
export declare function graphQLQuery<Variables extends Record<string, unknown>, Data>(query: string): (client: Client, variables: Variables) => Promise<Data>;
|
|
14
22
|
//# sourceMappingURL=graphql.d.ts.map
|
package/dist/graphql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/graphql.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/graphql.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEhE,oBAAY,UAAU,GAClB,CAAC,YAAY,GAAG;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,GACF,MAAM,GACN,SAAS,CAAC;AAEd,oBAAY,iBAAiB,GACzB,CAAC,UAAU,GAAG;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,GACF,MAAM,CAAC;AAEX,oBAAY,kBAAkB,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,KAAK,MAAM,CAAC;AAevF,eAAO,MAAM,kBAAkB,oBAA8C,CAAC;AAC9E,eAAO,MAAM,uBAAuB,oBAAwD,CAAC;AAE7F,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAOD,eAAO,MAAM,sBAAsB,uBACZ,kBAAkB,cAC9B,SAAS,aAAa,MAAM,eAAe,UAAU,oDAAsC,MAkCnG,CAAC;AAEJ,eAAO,MAAM,eAAe,WApCjB,SAAS,aAAa,MAAM,eAAe,UAAU,oDAAsC,MAoC7B,CAAC;AAC1E,eAAO,MAAM,oBAAoB,WArCtB,SAAS,aAAa,MAAM,eAAe,UAAU,oDAAsC,MAqCnB,CAAC;AAEpF,wBAAgB,YAAY,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YACnE,MAAM,aAAa,SAAS,KAAG,QAAQ,IAAI,CAAC,CAQnE"}
|
package/dist/graphql.js
CHANGED
|
@@ -14,24 +14,32 @@ var _errors = require("./errors");
|
|
|
14
14
|
|
|
15
15
|
var _api = require("./util/api");
|
|
16
16
|
|
|
17
|
+
var _branches = require("./util/branches");
|
|
18
|
+
|
|
17
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
20
|
|
|
19
|
-
const getGraphQLEndpointFactory = path => (params,
|
|
20
|
-
const
|
|
21
|
-
|
|
21
|
+
const getGraphQLEndpointFactory = (path, useBranch) => (params, pathParams) => {
|
|
22
|
+
const projectId = typeof pathParams === 'object' ? pathParams.projectId : pathParams;
|
|
23
|
+
const branchParams = typeof pathParams === 'object' ? pathParams : {
|
|
24
|
+
environment: 'PRODUCTION'
|
|
25
|
+
};
|
|
26
|
+
const basePath = projectId ? useBranch ? (0, _branches.getBranchBasePath)(branchParams, projectId) : `/project/${projectId}` : '';
|
|
27
|
+
return `${params.endpoint}${basePath}${path}`;
|
|
22
28
|
};
|
|
23
29
|
|
|
24
|
-
const getGraphQLEndpoint = getGraphQLEndpointFactory('
|
|
30
|
+
const getGraphQLEndpoint = getGraphQLEndpointFactory('/graphql', true);
|
|
25
31
|
exports.getGraphQLEndpoint = getGraphQLEndpoint;
|
|
26
|
-
const getGraphQLAdminEndpoint = getGraphQLEndpointFactory('v3/admin-graphql');
|
|
32
|
+
const getGraphQLAdminEndpoint = getGraphQLEndpointFactory('/v3/admin-graphql', false);
|
|
27
33
|
exports.getGraphQLAdminEndpoint = getGraphQLAdminEndpoint;
|
|
28
34
|
const defaultOptions = {
|
|
29
35
|
retries: 3,
|
|
30
36
|
timeout: 0
|
|
31
37
|
};
|
|
32
38
|
|
|
33
|
-
const createConnectorFactory = getGraphQLEndpoint => (params, authToken,
|
|
34
|
-
const endpoint = getGraphQLEndpoint(params,
|
|
39
|
+
const createConnectorFactory = getGraphQLEndpoint => (params, authToken, pathParams, options) => {
|
|
40
|
+
const endpoint = getGraphQLEndpoint(params, pathParams ?? {
|
|
41
|
+
environment: 'PRODUCTION'
|
|
42
|
+
});
|
|
35
43
|
const authHeader = (0, _api.getAuthHeader)(authToken);
|
|
36
44
|
const {
|
|
37
45
|
timeout,
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,8 @@ var _config = require("./config");
|
|
|
9
9
|
|
|
10
10
|
var _checkVersion = require("./check-version");
|
|
11
11
|
|
|
12
|
+
var _options = require("./options");
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
14
16
|
const help = `
|
|
@@ -20,6 +22,7 @@ const help = `
|
|
|
20
22
|
logout
|
|
21
23
|
link
|
|
22
24
|
unlink
|
|
25
|
+
branch
|
|
23
26
|
build
|
|
24
27
|
watch
|
|
25
28
|
schema
|
|
@@ -29,6 +32,20 @@ const help = `
|
|
|
29
32
|
export
|
|
30
33
|
validate
|
|
31
34
|
|
|
35
|
+
branch Subcommands
|
|
36
|
+
list list all branches
|
|
37
|
+
create create a branch
|
|
38
|
+
delete delete a branch
|
|
39
|
+
url get the url to the GraphQL API
|
|
40
|
+
latestUrl get the hashed url pinned to the latest version the GraphQL API
|
|
41
|
+
|
|
42
|
+
Examples
|
|
43
|
+
$ takeshape build --file path/to/tsg.yml
|
|
44
|
+
$ takeshape branch list
|
|
45
|
+
$ takeshape branch create --name my-feature
|
|
46
|
+
$ takeshape branch delete --name my-feature
|
|
47
|
+
$ takeshape branch url --production
|
|
48
|
+
|
|
32
49
|
Options
|
|
33
50
|
--token, -t TakeShape API auth token
|
|
34
51
|
--cliLogin, -l Log in using CLI (do not open browser)
|
|
@@ -40,6 +57,15 @@ const help = `
|
|
|
40
57
|
--cache -c use file cache (default false)
|
|
41
58
|
--watchContent, -W rebuild on content change (watch only)
|
|
42
59
|
|
|
60
|
+
branch Options
|
|
61
|
+
One of
|
|
62
|
+
--production specify the production environment, when using this branch name not allowed
|
|
63
|
+
--development specify the development environment, this is the default when --branch is specified
|
|
64
|
+
--scratch specify the scratch environment
|
|
65
|
+
|
|
66
|
+
--branch use with non-branch commands to specify the branch name, required when using --development
|
|
67
|
+
--name use with branch commands to specify the branch name, required when using --development
|
|
68
|
+
|
|
43
69
|
import Options
|
|
44
70
|
One of
|
|
45
71
|
--project import a takeshape project from given directory, zip or url
|
|
@@ -63,49 +89,13 @@ const help = `
|
|
|
63
89
|
|
|
64
90
|
Examples
|
|
65
91
|
$ takeshape build --file path/to/tsg.yml
|
|
92
|
+
$ takeshape branch list
|
|
93
|
+
$ takeshape branch create --name my-feature
|
|
94
|
+
$ takeshape branch delete --name my-feature
|
|
95
|
+
$ takeshape branch url --production
|
|
66
96
|
|
|
67
97
|
`;
|
|
68
|
-
const
|
|
69
|
-
flags: {
|
|
70
|
-
token: {
|
|
71
|
-
type: 'string',
|
|
72
|
-
alias: 't'
|
|
73
|
-
},
|
|
74
|
-
cliLogin: {
|
|
75
|
-
type: 'boolean',
|
|
76
|
-
alias: 'l'
|
|
77
|
-
},
|
|
78
|
-
site: {
|
|
79
|
-
type: 'string',
|
|
80
|
-
alias: 's'
|
|
81
|
-
},
|
|
82
|
-
file: {
|
|
83
|
-
type: 'string',
|
|
84
|
-
alias: 'f'
|
|
85
|
-
},
|
|
86
|
-
output: {
|
|
87
|
-
type: 'string',
|
|
88
|
-
alias: 'o'
|
|
89
|
-
},
|
|
90
|
-
endpoint: {
|
|
91
|
-
type: 'string',
|
|
92
|
-
alias: 'e'
|
|
93
|
-
},
|
|
94
|
-
version: {
|
|
95
|
-
alias: 'v'
|
|
96
|
-
},
|
|
97
|
-
cache: {
|
|
98
|
-
type: 'boolean',
|
|
99
|
-
alias: 'c'
|
|
100
|
-
},
|
|
101
|
-
watchContent: {
|
|
102
|
-
type: 'boolean',
|
|
103
|
-
alias: 'W'
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
const cli = (0, _meow.default)(help, meowOptions);
|
|
98
|
+
const cli = (0, _meow.default)(help, _options.options);
|
|
108
99
|
const cwd = process.cwd();
|
|
109
|
-
const command = cli.input[0];
|
|
110
100
|
(0, _checkVersion.checkVersion)(process.version);
|
|
111
|
-
void (0, _main.default)(
|
|
101
|
+
void (0, _main.default)(cli, (0, _config.loadConfig)(cwd, cli));
|
package/dist/main.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function _default(
|
|
1
|
+
export default function _default(cli: any, params: any): Promise<void>;
|
|
2
2
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.js"],"names":[],"mappings":"AAmBA,uEASC"}
|
package/dist/main.js
CHANGED
|
@@ -22,16 +22,18 @@ const commandPath = {
|
|
|
22
22
|
status: 'status',
|
|
23
23
|
import: 'import',
|
|
24
24
|
export: 'export',
|
|
25
|
-
validate: 'validate'
|
|
25
|
+
validate: 'validate',
|
|
26
|
+
branch: 'branch'
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
async function _default(
|
|
29
|
+
async function _default(cli, params) {
|
|
30
|
+
const command = cli.input[0];
|
|
29
31
|
const path = commandPath[command];
|
|
30
32
|
|
|
31
33
|
if (path) {
|
|
32
34
|
const fn = require(`./commands/${path}`).default;
|
|
33
35
|
|
|
34
|
-
await fn(
|
|
36
|
+
await fn(cli, params);
|
|
35
37
|
} else {
|
|
36
38
|
(0, _log.default)('No such command:' + cli.help);
|
|
37
39
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export declare type Flags = typeof options.flags;
|
|
75
|
+
export declare type Cli = Pick<Result<Flags>, 'input'> & {
|
|
76
|
+
flags: Partial<Result<Flags>['flags']>;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEV,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
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.options = options;
|