@takeshape/cli 8.251.2 → 8.254.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/tag-version.d.ts +2 -0
- package/dist/commands/branch/commands/tag-version.d.ts.map +1 -0
- package/dist/commands/branch/commands/tag-version.js +59 -0
- package/dist/commands/branch/commands/url.d.ts +1 -1
- package/dist/commands/branch/commands/url.d.ts.map +1 -1
- package/dist/commands/branch/commands/url.js +25 -12
- package/dist/commands/branch/index.d.ts.map +1 -1
- package/dist/commands/branch/index.js +5 -2
- package/dist/commands/import/schema-import.d.ts.map +1 -1
- package/dist/commands/import/schema-import.js +14 -1
- package/dist/index.js +19 -8
- package/dist/options.d.ts +6 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +6 -0
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-version.d.ts","sourceRoot":"","sources":["../../../../../src/commands/branch/commands/tag-version.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,gBAAgB,kCAsB3B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tagBranchVersion = void 0;
|
|
7
|
+
|
|
8
|
+
var _linkedCommand = require("../../../util/linked-command");
|
|
9
|
+
|
|
10
|
+
var _graphql = require("../../../graphql");
|
|
11
|
+
|
|
12
|
+
var _branches = require("../../../util/branches");
|
|
13
|
+
|
|
14
|
+
var _fatalError = require("../../../util/fatal-error");
|
|
15
|
+
|
|
16
|
+
const createBranchTag = (0, _graphql.graphQLQuery)(
|
|
17
|
+
/* GraphQL */
|
|
18
|
+
`
|
|
19
|
+
mutation ($input: TSCreateSchemaBranchTagInput!) {
|
|
20
|
+
result: tsCreateSchemaBranchTag(input: $input) {
|
|
21
|
+
branchVersion {
|
|
22
|
+
graphqlUrl
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`);
|
|
27
|
+
const tagBranchVersion = (0, _linkedCommand.loggedInAndLinkedCommand)(async (cli, params) => {
|
|
28
|
+
const {
|
|
29
|
+
branch,
|
|
30
|
+
environment
|
|
31
|
+
} = (0, _branches.getBranchParams)(cli, 'name');
|
|
32
|
+
const {
|
|
33
|
+
flags
|
|
34
|
+
} = cli;
|
|
35
|
+
const {
|
|
36
|
+
tag,
|
|
37
|
+
hash
|
|
38
|
+
} = flags;
|
|
39
|
+
|
|
40
|
+
if (!tag) {
|
|
41
|
+
return (0, _fatalError.fatalError)('--tag flag is required');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const client = (0, _graphql.createAdminConnector)(params, params.authToken, params.projectId);
|
|
45
|
+
const {
|
|
46
|
+
branchVersion: {
|
|
47
|
+
graphqlUrl
|
|
48
|
+
}
|
|
49
|
+
} = await createBranchTag(client, {
|
|
50
|
+
input: {
|
|
51
|
+
environment,
|
|
52
|
+
branchName: branch,
|
|
53
|
+
tagName: tag,
|
|
54
|
+
schemaHash: hash
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
process.stdout.write(graphqlUrl);
|
|
58
|
+
});
|
|
59
|
+
exports.tagBranchVersion = tagBranchVersion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../../src/commands/branch/commands/url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../../src/commands/branch/commands/url.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,aAAa,kCAiBxB,CAAC;AAEH,eAAO,MAAM,MAAM,kCAGjB,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getVersionUrl = exports.getUrl = void 0;
|
|
7
7
|
|
|
8
8
|
var _linkedCommand = require("../../../util/linked-command");
|
|
9
9
|
|
|
@@ -11,32 +11,45 @@ var _graphql = require("../../../graphql");
|
|
|
11
11
|
|
|
12
12
|
var _branches = require("../../../util/branches");
|
|
13
13
|
|
|
14
|
-
const getBranchQuery = (0, _graphql.graphQLQuery)(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const getBranchQuery = (0, _graphql.graphQLQuery)(
|
|
15
|
+
/* GraphQL */
|
|
16
|
+
`
|
|
17
|
+
query ($environment: TSSchemaBranchEnvironment!, $branchName: String, $tagName: String, $schemaHash: String) {
|
|
18
|
+
result: tsGetSchemaBranchVersion(
|
|
19
|
+
environment: $environment
|
|
20
|
+
branchName: $branchName
|
|
21
|
+
tagName: $tagName
|
|
22
|
+
schemaHash: $schemaHash
|
|
23
|
+
) {
|
|
18
24
|
graphqlUrl
|
|
19
25
|
}
|
|
20
26
|
}
|
|
21
|
-
}
|
|
22
27
|
`);
|
|
23
|
-
const
|
|
28
|
+
const getVersionUrl = (0, _linkedCommand.loggedInAndLinkedCommand)(async (cli, params) => {
|
|
24
29
|
const {
|
|
25
30
|
branch,
|
|
26
31
|
environment
|
|
27
32
|
} = (0, _branches.getBranchParams)(cli, 'name');
|
|
33
|
+
const {
|
|
34
|
+
flags
|
|
35
|
+
} = cli;
|
|
36
|
+
|
|
37
|
+
if (flags.tag && flags.hash) {
|
|
38
|
+
throw new Error('Can only provide one of: --tag OR --hash');
|
|
39
|
+
}
|
|
40
|
+
|
|
28
41
|
const client = (0, _graphql.createAdminConnector)(params, params.authToken, params.projectId);
|
|
29
42
|
const {
|
|
30
|
-
|
|
31
|
-
graphqlUrl
|
|
32
|
-
}
|
|
43
|
+
graphqlUrl
|
|
33
44
|
} = await getBranchQuery(client, {
|
|
34
45
|
environment,
|
|
35
|
-
branchName: branch
|
|
46
|
+
branchName: branch,
|
|
47
|
+
tagName: flags.tag,
|
|
48
|
+
schemaHash: flags.hash
|
|
36
49
|
});
|
|
37
50
|
process.stdout.write(graphqlUrl);
|
|
38
51
|
});
|
|
39
|
-
exports.
|
|
52
|
+
exports.getVersionUrl = getVersionUrl;
|
|
40
53
|
const getUrl = (0, _linkedCommand.loggedInAndLinkedCommand)(async (cli, params) => {
|
|
41
54
|
const branchParams = (0, _branches.getBranchParams)(cli, 'name');
|
|
42
55
|
process.stdout.write(`${params.endpoint}${(0, _branches.getBranchBasePath)(branchParams, params.projectId)}/graphql`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/branch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/branch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AAmBpC,QAAA,MAAM,cAAc,EAAE,OAQrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -17,13 +17,16 @@ var _url = require("./commands/url");
|
|
|
17
17
|
|
|
18
18
|
var _list = require("./commands/list");
|
|
19
19
|
|
|
20
|
+
var _tagVersion = require("./commands/tag-version");
|
|
21
|
+
|
|
20
22
|
const subcommands = {
|
|
21
23
|
delete: _delete.deleteBranch,
|
|
22
24
|
create: _create.createBranch,
|
|
23
25
|
promote: _promote.promoteBranch,
|
|
24
26
|
url: _url.getUrl,
|
|
25
|
-
|
|
26
|
-
list: _list.listBranches
|
|
27
|
+
versionUrl: _url.getVersionUrl,
|
|
28
|
+
list: _list.listBranches,
|
|
29
|
+
tagVersion: _tagVersion.tagBranchVersion
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
const commandHandler = async (cli, params) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-import.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/schema-import.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"schema-import.d.ts","sourceRoot":"","sources":["../../../../src/commands/import/schema-import.ts"],"names":[],"mappings":";AAsBA,wBAyCG"}
|
|
@@ -25,6 +25,8 @@ var _fs = require("../../util/fs");
|
|
|
25
25
|
|
|
26
26
|
var _branches = require("../../util/branches");
|
|
27
27
|
|
|
28
|
+
var _url = require("url");
|
|
29
|
+
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
30
32
|
/*
|
|
@@ -58,6 +60,17 @@ var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
const branchParams = (0, _branches.getBranchParams)(cli);
|
|
63
|
+
const queryParams = {
|
|
64
|
+
force: 'true'
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
if (flags.preserveAuth) {
|
|
68
|
+
queryParams.preserveAuth = 'true';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (flags.tag) {
|
|
72
|
+
queryParams.tag = flags.tag;
|
|
73
|
+
}
|
|
61
74
|
|
|
62
75
|
try {
|
|
63
76
|
const newSchema = JSON.parse(_fsExtra.default.readFileSync(file).toString());
|
|
@@ -70,7 +83,7 @@ var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
|
|
|
70
83
|
}
|
|
71
84
|
|
|
72
85
|
(0, _log.default)(`Uploading schema from ${file}…\n`);
|
|
73
|
-
const schemaImportPath = `${(0, _branches.getBranchBasePath)(branchParams, projectId)}/schema
|
|
86
|
+
const schemaImportPath = `${(0, _branches.getBranchBasePath)(branchParams, projectId)}/schema?${new _url.URLSearchParams(queryParams)}`;
|
|
74
87
|
const uploaded = await (0, _api.default)(params, 'POST', schemaImportPath, newSchema);
|
|
75
88
|
(0, _log.default)(_chalk.default.green('Success!'), `Schema updated to version ${uploaded.version}.`);
|
|
76
89
|
process.exit(0);
|
package/dist/index.js
CHANGED
|
@@ -33,12 +33,17 @@ const help = `
|
|
|
33
33
|
validate
|
|
34
34
|
|
|
35
35
|
branch Subcommands
|
|
36
|
-
list
|
|
37
|
-
create
|
|
38
|
-
delete
|
|
39
|
-
promote
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
42
47
|
|
|
43
48
|
Examples
|
|
44
49
|
$ takeshape build --file path/to/tsg.yml
|
|
@@ -47,6 +52,7 @@ const help = `
|
|
|
47
52
|
$ takeshape branch delete --name my-feature
|
|
48
53
|
$ takeshape branch promote --name my-feature
|
|
49
54
|
$ takeshape branch url --production
|
|
55
|
+
$ takeshape branch tagVersion --name my-feature --tag my-tag
|
|
50
56
|
|
|
51
57
|
Options
|
|
52
58
|
--token, -t TakeShape API auth token
|
|
@@ -65,8 +71,12 @@ const help = `
|
|
|
65
71
|
--development specify the development environment, this is the default when --branch is specified
|
|
66
72
|
--scratch specify the scratch environment
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
Only for the tagVersion and url commands
|
|
75
|
+
--tag tag to apply to a branch version
|
|
76
|
+
--hash (optional) which version to hash — if not specified will tag the latest
|
|
77
|
+
|
|
78
|
+
--branch use with non-branch commands to specify the branch name, required when using --development
|
|
79
|
+
--name use with branch commands to specify the branch name, required when using --development
|
|
70
80
|
|
|
71
81
|
import Options
|
|
72
82
|
One of
|
|
@@ -78,6 +88,7 @@ const help = `
|
|
|
78
88
|
--to either "new-project" or "current-project" (default "new-project")
|
|
79
89
|
--name for use with --project specifies a new name for the imported project
|
|
80
90
|
--preserveAuth do not overwrite service authentication
|
|
91
|
+
--tag apply a tag to the imported version
|
|
81
92
|
|
|
82
93
|
export Options
|
|
83
94
|
One of
|
package/dist/options.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ export declare const options: {
|
|
|
72
72
|
readonly preserveAuth: {
|
|
73
73
|
readonly type: "boolean";
|
|
74
74
|
};
|
|
75
|
+
readonly tag: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
};
|
|
78
|
+
readonly hash: {
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
};
|
|
75
81
|
};
|
|
76
82
|
};
|
|
77
83
|
export declare type Flags = typeof options.flags;
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFV,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
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.254.0",
|
|
4
4
|
"description": "TakeShape CLI",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"@graphql-codegen/typescript": "^2.4.5",
|
|
26
26
|
"@graphql-tools/graphql-file-loader": "^7.3.3",
|
|
27
27
|
"@graphql-tools/load": "^7.5.1",
|
|
28
|
-
"@takeshape/schema": "8.
|
|
29
|
-
"@takeshape/ssg": "8.
|
|
30
|
-
"@takeshape/streams": "8.
|
|
31
|
-
"@takeshape/util": "8.
|
|
28
|
+
"@takeshape/schema": "8.254.0",
|
|
29
|
+
"@takeshape/ssg": "8.254.0",
|
|
30
|
+
"@takeshape/streams": "8.254.0",
|
|
31
|
+
"@takeshape/util": "8.254.0",
|
|
32
32
|
"archiver": "^1.3.0",
|
|
33
33
|
"async-retry": "^1.2.1",
|
|
34
34
|
"bluebird": "^3.4.6",
|