@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.
- package/package.json +14 -9
- package/dist/auth.d.ts +0 -5
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -76
- package/dist/check-version.d.ts +0 -2
- package/dist/check-version.d.ts.map +0 -1
- package/dist/check-version.js +0 -22
- package/dist/commands/branch/commands/create.d.ts +0 -2
- package/dist/commands/branch/commands/create.d.ts.map +0 -1
- package/dist/commands/branch/commands/create.js +0 -67
- package/dist/commands/branch/commands/delete.d.ts +0 -2
- package/dist/commands/branch/commands/delete.d.ts.map +0 -1
- package/dist/commands/branch/commands/delete.js +0 -58
- package/dist/commands/branch/commands/list.d.ts +0 -12
- package/dist/commands/branch/commands/list.d.ts.map +0 -1
- package/dist/commands/branch/commands/list.js +0 -54
- package/dist/commands/branch/commands/merge.d.ts +0 -2
- package/dist/commands/branch/commands/merge.d.ts.map +0 -1
- package/dist/commands/branch/commands/merge.js +0 -158
- package/dist/commands/branch/commands/promote.d.ts +0 -2
- package/dist/commands/branch/commands/promote.d.ts.map +0 -1
- package/dist/commands/branch/commands/promote.js +0 -50
- package/dist/commands/branch/commands/tag-version.d.ts +0 -2
- package/dist/commands/branch/commands/tag-version.d.ts.map +0 -1
- package/dist/commands/branch/commands/tag-version.js +0 -59
- package/dist/commands/branch/commands/url.d.ts +0 -3
- package/dist/commands/branch/commands/url.d.ts.map +0 -1
- package/dist/commands/branch/commands/url.js +0 -84
- package/dist/commands/branch/index.d.ts +0 -4
- package/dist/commands/branch/index.d.ts.map +0 -1
- package/dist/commands/branch/index.js +0 -47
- package/dist/commands/build-or-watch.d.ts +0 -4
- package/dist/commands/build-or-watch.d.ts.map +0 -1
- package/dist/commands/build-or-watch.js +0 -73
- package/dist/commands/deploy/index.d.ts +0 -9
- package/dist/commands/deploy/index.d.ts.map +0 -1
- package/dist/commands/deploy/index.js +0 -74
- package/dist/commands/deploy/zip.d.ts +0 -18
- package/dist/commands/deploy/zip.d.ts.map +0 -1
- package/dist/commands/deploy/zip.js +0 -57
- package/dist/commands/export/index.d.ts +0 -4
- package/dist/commands/export/index.d.ts.map +0 -1
- package/dist/commands/export/index.js +0 -23
- package/dist/commands/export/project-export.d.ts +0 -8
- package/dist/commands/export/project-export.d.ts.map +0 -1
- package/dist/commands/export/project-export.js +0 -109
- package/dist/commands/export/schema-export.d.ts +0 -3
- package/dist/commands/export/schema-export.d.ts.map +0 -1
- package/dist/commands/export/schema-export.js +0 -88
- package/dist/commands/import/index.d.ts +0 -4
- package/dist/commands/import/index.d.ts.map +0 -1
- package/dist/commands/import/index.js +0 -33
- package/dist/commands/import/project-import.d.ts +0 -11
- package/dist/commands/import/project-import.d.ts.map +0 -1
- package/dist/commands/import/project-import.js +0 -198
- package/dist/commands/import/roles-import.d.ts +0 -3
- package/dist/commands/import/roles-import.d.ts.map +0 -1
- package/dist/commands/import/roles-import.js +0 -59
- package/dist/commands/import/schema-import.d.ts +0 -3
- package/dist/commands/import/schema-import.d.ts.map +0 -1
- package/dist/commands/import/schema-import.js +0 -93
- package/dist/commands/link.d.ts +0 -3
- package/dist/commands/link.d.ts.map +0 -1
- package/dist/commands/link.js +0 -63
- package/dist/commands/login.d.ts +0 -4
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -32
- package/dist/commands/logout.d.ts +0 -4
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -30
- package/dist/commands/schema.d.ts +0 -3
- package/dist/commands/schema.d.ts.map +0 -1
- package/dist/commands/schema.js +0 -25
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -18
- package/dist/commands/types.d.ts +0 -3
- package/dist/commands/types.d.ts.map +0 -1
- package/dist/commands/types.js +0 -30
- package/dist/commands/unlink.d.ts +0 -4
- package/dist/commands/unlink.d.ts.map +0 -1
- package/dist/commands/unlink.js +0 -30
- package/dist/commands/validate.d.ts +0 -4
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/validate.js +0 -57
- package/dist/config.d.ts +0 -13
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -161
- package/dist/deprecated.d.ts +0 -2
- package/dist/deprecated.d.ts.map +0 -1
- package/dist/deprecated.js +0 -9
- package/dist/errors.d.ts +0 -7
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -36
- package/dist/files.d.ts +0 -4
- package/dist/files.d.ts.map +0 -1
- package/dist/files.js +0 -56
- package/dist/graphql.d.ts +0 -22
- package/dist/graphql.d.ts.map +0 -1
- package/dist/graphql.js +0 -104
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -128
- package/dist/log.d.ts +0 -4
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -21
- package/dist/main.d.ts +0 -2
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -40
- package/dist/options.d.ts +0 -102
- package/dist/options.d.ts.map +0 -1
- package/dist/options.js +0 -103
- package/dist/prompt.d.ts +0 -11
- package/dist/prompt.d.ts.map +0 -1
- package/dist/prompt.js +0 -39
- package/dist/types.d.ts +0 -47
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -20
- package/dist/util/api.d.ts +0 -5
- package/dist/util/api.d.ts.map +0 -1
- package/dist/util/api.js +0 -76
- package/dist/util/branches.d.ts +0 -18
- package/dist/util/branches.d.ts.map +0 -1
- package/dist/util/branches.js +0 -77
- package/dist/util/cached-connector.d.ts +0 -5
- package/dist/util/cached-connector.d.ts.map +0 -1
- package/dist/util/cached-connector.js +0 -34
- package/dist/util/connector.d.ts +0 -8
- package/dist/util/connector.d.ts.map +0 -1
- package/dist/util/connector.js +0 -19
- package/dist/util/data.d.ts +0 -39
- package/dist/util/data.d.ts.map +0 -1
- package/dist/util/data.js +0 -165
- package/dist/util/fatal-error.d.ts +0 -2
- package/dist/util/fatal-error.d.ts.map +0 -1
- package/dist/util/fatal-error.js +0 -17
- package/dist/util/format-error.d.ts +0 -2
- package/dist/util/format-error.d.ts.map +0 -1
- package/dist/util/format-error.js +0 -10
- package/dist/util/format-validation-result.d.ts +0 -3
- package/dist/util/format-validation-result.d.ts.map +0 -1
- package/dist/util/format-validation-result.js +0 -17
- package/dist/util/fs.d.ts +0 -5
- package/dist/util/fs.d.ts.map +0 -1
- package/dist/util/fs.js +0 -42
- package/dist/util/generate-types.d.ts +0 -5
- package/dist/util/generate-types.d.ts.map +0 -1
- package/dist/util/generate-types.js +0 -63
- package/dist/util/get-client-schema.d.ts +0 -5
- package/dist/util/get-client-schema.d.ts.map +0 -1
- package/dist/util/get-client-schema.js +0 -31
- package/dist/util/glitch.d.ts +0 -5
- package/dist/util/glitch.d.ts.map +0 -1
- package/dist/util/glitch.js +0 -51
- package/dist/util/linked-command.d.ts +0 -5
- package/dist/util/linked-command.d.ts.map +0 -1
- package/dist/util/linked-command.js +0 -48
- package/dist/util/login.d.ts +0 -21
- package/dist/util/login.d.ts.map +0 -1
- package/dist/util/login.js +0 -141
- package/dist/util/messages.d.ts +0 -13
- package/dist/util/messages.d.ts.map +0 -1
- package/dist/util/messages.js +0 -60
- package/dist/util/ora-wrapper.d.ts +0 -2
- package/dist/util/ora-wrapper.d.ts.map +0 -1
- package/dist/util/ora-wrapper.js +0 -28
- package/dist/util/pusher.d.ts +0 -10
- package/dist/util/pusher.d.ts.map +0 -1
- package/dist/util/pusher.js +0 -34
- package/dist/util/runner.d.ts +0 -2
- package/dist/util/runner.d.ts.map +0 -1
- package/dist/util/runner.js +0 -46
- package/dist/util/select-project.d.ts +0 -4
- package/dist/util/select-project.d.ts.map +0 -1
- package/dist/util/select-project.js +0 -23
- package/dist/util/spin.d.ts +0 -7
- package/dist/util/spin.d.ts.map +0 -1
- package/dist/util/spin.js +0 -41
- package/dist/util/upload.d.ts +0 -5
- package/dist/util/upload.d.ts.map +0 -1
- package/dist/util/upload.js +0 -55
- package/dist/util/watcher.d.ts +0 -2
- package/dist/util/watcher.d.ts.map +0 -1
- package/dist/util/watcher.js +0 -30
package/dist/util/branches.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getBranchArgs = getBranchArgs;
|
|
7
|
-
exports.getBranchBasePath = getBranchBasePath;
|
|
8
|
-
exports.getBranchParams = getBranchParams;
|
|
9
|
-
exports.getEnvironment = getEnvironment;
|
|
10
|
-
exports.isEnvironment = isEnvironment;
|
|
11
|
-
|
|
12
|
-
var _fatalError = require("./fatal-error");
|
|
13
|
-
|
|
14
|
-
var _compact = _interopRequireDefault(require("lodash/compact"));
|
|
15
|
-
|
|
16
|
-
var _branches = require("@takeshape/branches");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
function getEnvironment(cli, flag = 'branch') {
|
|
21
|
-
if (cli.flags.production) {
|
|
22
|
-
return _branches.BRANCH_ENVIRONMENT_PRODUCTION_ENUM;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (cli.flags.development) {
|
|
26
|
-
return _branches.BRANCH_ENVIRONMENT_DEVELOPMENT_ENUM;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (cli.flags.scratch) {
|
|
30
|
-
return _branches.BRANCH_ENVIRONMENT_SCRATCH_ENUM;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return cli.flags[flag] ? _branches.BRANCH_ENVIRONMENT_DEVELOPMENT_ENUM : _branches.BRANCH_ENVIRONMENT_PRODUCTION_ENUM;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function isEnvironment(environment) {
|
|
37
|
-
return [_branches.BRANCH_ENVIRONMENT_PRODUCTION_ENUM, _branches.BRANCH_ENVIRONMENT_DEVELOPMENT_ENUM, _branches.BRANCH_ENVIRONMENT_SCRATCH_ENUM].includes(environment);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function getBranchArgs(name) {
|
|
41
|
-
if (name === _branches.BRANCH_ENVIRONMENT_PRODUCTION) {
|
|
42
|
-
return {
|
|
43
|
-
environment: _branches.BRANCH_ENVIRONMENT_PRODUCTION_ENUM
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
environment: _branches.BRANCH_ENVIRONMENT_DEVELOPMENT_ENUM,
|
|
49
|
-
branchName: name
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function getBranchParams(cli, flag = 'branch') {
|
|
54
|
-
const branch = cli.flags[flag];
|
|
55
|
-
const environment = getEnvironment(cli, flag);
|
|
56
|
-
|
|
57
|
-
if (environment === _branches.BRANCH_ENVIRONMENT_PRODUCTION_ENUM && branch) {
|
|
58
|
-
return (0, _fatalError.fatalError)('There is only one production branch --name is invalid');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (environment === _branches.BRANCH_ENVIRONMENT_DEVELOPMENT_ENUM && !branch) {
|
|
62
|
-
return (0, _fatalError.fatalError)('Development branches require a name, please specify one with --name');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
branch,
|
|
67
|
-
environment
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function getBranchBasePath({
|
|
72
|
-
environment,
|
|
73
|
-
branch
|
|
74
|
-
}, projectId) {
|
|
75
|
-
const branchComponent = branch ? encodeURIComponent(branch) : undefined;
|
|
76
|
-
return '/' + (0, _compact.default)(['project', projectId, environment.toLowerCase(), branchComponent]).join('/');
|
|
77
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cached-connector.d.ts","sourceRoot":"","sources":["../../../src/util/cached-connector.js"],"names":[],"mappings":"AAMA;;;EAeC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.connectorWithCache = connectorWithCache;
|
|
7
|
-
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
11
|
-
|
|
12
|
-
var _objectHash = _interopRequireDefault(require("object-hash"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
const cacheDir = '.cache';
|
|
17
|
-
|
|
18
|
-
function connectorWithCache(connector) {
|
|
19
|
-
const decorated = async params => {
|
|
20
|
-
const cachePath = _path.default.join(cacheDir, `${(0, _objectHash.default)(params)}.json`);
|
|
21
|
-
|
|
22
|
-
if (await _fsExtra.default.pathExists(cachePath)) {
|
|
23
|
-
return _fsExtra.default.readJSON(cachePath);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const [result] = await Promise.all([connector(params), _fsExtra.default.mkdirs(cacheDir)]);
|
|
27
|
-
await _fsExtra.default.writeJSON(cachePath, result);
|
|
28
|
-
return result;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
decorated.clearCache = async () => _fsExtra.default.remove(cacheDir);
|
|
32
|
-
|
|
33
|
-
return decorated;
|
|
34
|
-
}
|
package/dist/util/connector.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { GraphQLConnectorOptions } from '../graphql';
|
|
2
|
-
import { LinkedCliConfig } from '../types';
|
|
3
|
-
import { BranchParams } from './branches';
|
|
4
|
-
export declare function createConnector(params: LinkedCliConfig, branchParams: BranchParams, options?: GraphQLConnectorOptions): {
|
|
5
|
-
(params: any): Promise<any>;
|
|
6
|
-
clearCache(): Promise<void>;
|
|
7
|
-
} | import("../ssg/src/types").GraphQLConnector;
|
|
8
|
-
//# sourceMappingURL=connector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/util/connector.ts"],"names":[],"mappings":"AACA,OAAO,EAAyC,uBAAuB,EAAC,MAAM,YAAY,CAAC;AAE3F,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,YAAY,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,uBAAuB;;;gDAMlC"}
|
package/dist/util/connector.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createConnector = createConnector;
|
|
7
|
-
|
|
8
|
-
var _ssg = require("@takeshape/ssg");
|
|
9
|
-
|
|
10
|
-
var _graphql = require("../graphql");
|
|
11
|
-
|
|
12
|
-
var _cachedConnector = require("./cached-connector");
|
|
13
|
-
|
|
14
|
-
function createConnector(params, branchParams, options) {
|
|
15
|
-
const connector = (0, _ssg.connectorWithMigrations)((0, _graphql.createConnector)(params, params.linkedApiKey.apiKey, { ...branchParams,
|
|
16
|
-
projectId: params.projectId
|
|
17
|
-
}, options));
|
|
18
|
-
return options !== null && options !== void 0 && options.cache ? (0, _cachedConnector.connectorWithCache)(connector) : connector;
|
|
19
|
-
}
|
package/dist/util/data.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ProjectPathParams } from '../graphql';
|
|
2
|
-
import { LoggedInCliConfig, CliConfig } from '../types';
|
|
3
|
-
import { Choice } from '../prompt';
|
|
4
|
-
export declare const projectListQuery = "\n {\n projects: tsGetProjectList {\n value: id\n name\n invite\n }\n }\n";
|
|
5
|
-
export declare const siteListQuery = "\n {\n sites: getTsStaticSiteList {\n items {\n value: _id\n name: title\n }\n }\n }\n";
|
|
6
|
-
export interface ProjectChoice extends Choice {
|
|
7
|
-
invite: unknown;
|
|
8
|
-
}
|
|
9
|
-
export declare function fetchProjects(params: LoggedInCliConfig): Promise<Choice[]>;
|
|
10
|
-
export declare const laterSite: {
|
|
11
|
-
name: string;
|
|
12
|
-
value: string;
|
|
13
|
-
};
|
|
14
|
-
export declare function fetchSites(params: LoggedInCliConfig, pathParams: ProjectPathParams): Promise<Choice[]>;
|
|
15
|
-
export interface PersonalAccessToken {
|
|
16
|
-
accessToken: string;
|
|
17
|
-
id: string;
|
|
18
|
-
}
|
|
19
|
-
export interface ApiKey {
|
|
20
|
-
id: string;
|
|
21
|
-
apiKey: string;
|
|
22
|
-
}
|
|
23
|
-
export declare const createPersonalAccessTokenMutation: (client: import("../types").Client, variables: {
|
|
24
|
-
name: string;
|
|
25
|
-
}) => Promise<PersonalAccessToken>;
|
|
26
|
-
export declare const createReadOnlyApiKeyMutation: (client: import("../types").Client, variables: {
|
|
27
|
-
name: string;
|
|
28
|
-
}) => Promise<ApiKey>;
|
|
29
|
-
export declare const deletePersonalAccessTokenMutation: (client: import("../types").Client, variables: {
|
|
30
|
-
id: string;
|
|
31
|
-
}) => Promise<boolean>;
|
|
32
|
-
export declare const deleteApiKeyMutation: (client: import("../types").Client, variables: {
|
|
33
|
-
id: string;
|
|
34
|
-
}) => Promise<boolean>;
|
|
35
|
-
export declare function createPersonalAccessToken(params: CliConfig, userJwt: string): Promise<PersonalAccessToken>;
|
|
36
|
-
export declare function deletePersonalAccessToken(params: LoggedInCliConfig): Promise<boolean>;
|
|
37
|
-
export declare function createReadOnlyApiKey(params: LoggedInCliConfig, pathParams: ProjectPathParams): Promise<ApiKey>;
|
|
38
|
-
export declare function deleteApiKey(params: LoggedInCliConfig, pathParams: ProjectPathParams, apiKeyId: string): Promise<boolean>;
|
|
39
|
-
//# sourceMappingURL=data.d.ts.map
|
package/dist/util/data.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/util/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAElG,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AACtD,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAGjC,eAAO,MAAM,gBAAgB,4HAQ5B,CAAC;AAEF,eAAO,MAAM,aAAa,sJASzB,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQhF;AAED,eAAO,MAAM,SAAS;;;CAA6C,CAAC;AAEpE,wBAAsB,UAAU,CAAC,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAS5G;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,iCAAiC;UAAuB,MAAM;kCAOzE,CAAC;AAEH,eAAO,MAAM,4BAA4B;UAAuB,MAAM;qBAOpE,CAAC;AAEH,eAAO,MAAM,iCAAiC;QAAqB,MAAM;sBAIvE,CAAC;AAEH,eAAO,MAAM,oBAAoB;QAAqB,MAAM;sBAI1D,CAAC;AAMH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAOhH;AAED,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,oBAWxE;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAOpH;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,oBAO5G"}
|
package/dist/util/data.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createPersonalAccessToken = createPersonalAccessToken;
|
|
7
|
-
exports.createPersonalAccessTokenMutation = void 0;
|
|
8
|
-
exports.createReadOnlyApiKey = createReadOnlyApiKey;
|
|
9
|
-
exports.createReadOnlyApiKeyMutation = void 0;
|
|
10
|
-
exports.deleteApiKey = deleteApiKey;
|
|
11
|
-
exports.deleteApiKeyMutation = void 0;
|
|
12
|
-
exports.deletePersonalAccessToken = deletePersonalAccessToken;
|
|
13
|
-
exports.deletePersonalAccessTokenMutation = void 0;
|
|
14
|
-
exports.fetchProjects = fetchProjects;
|
|
15
|
-
exports.fetchSites = fetchSites;
|
|
16
|
-
exports.siteListQuery = exports.projectListQuery = exports.laterSite = void 0;
|
|
17
|
-
|
|
18
|
-
var _graphql = require("../graphql");
|
|
19
|
-
|
|
20
|
-
var _errors = require("../errors");
|
|
21
|
-
|
|
22
|
-
var _os = _interopRequireDefault(require("os"));
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
const projectListQuery = `
|
|
27
|
-
{
|
|
28
|
-
projects: tsGetProjectList {
|
|
29
|
-
value: id
|
|
30
|
-
name
|
|
31
|
-
invite
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
exports.projectListQuery = projectListQuery;
|
|
36
|
-
const siteListQuery = `
|
|
37
|
-
{
|
|
38
|
-
sites: getTsStaticSiteList {
|
|
39
|
-
items {
|
|
40
|
-
value: _id
|
|
41
|
-
name: title
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
exports.siteListQuery = siteListQuery;
|
|
47
|
-
|
|
48
|
-
async function fetchProjects(params) {
|
|
49
|
-
try {
|
|
50
|
-
const client = (0, _graphql.createAdminConnector)(params, params.authToken);
|
|
51
|
-
const {
|
|
52
|
-
data
|
|
53
|
-
} = await client({
|
|
54
|
-
query: projectListQuery
|
|
55
|
-
});
|
|
56
|
-
return data.projects.filter(p => (p === null || p === void 0 ? void 0 : p.invite) === null);
|
|
57
|
-
} catch (e) {
|
|
58
|
-
throw (0, _errors.formatErrorMessage)(e, 'fetching your projects');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const laterSite = {
|
|
63
|
-
name: 'Select site later',
|
|
64
|
-
value: 'NONE'
|
|
65
|
-
};
|
|
66
|
-
exports.laterSite = laterSite;
|
|
67
|
-
|
|
68
|
-
async function fetchSites(params, pathParams) {
|
|
69
|
-
try {
|
|
70
|
-
const client = (0, _graphql.createConnector)(params, params.authToken, pathParams);
|
|
71
|
-
const {
|
|
72
|
-
data
|
|
73
|
-
} = await client({
|
|
74
|
-
query: siteListQuery
|
|
75
|
-
});
|
|
76
|
-
const sites = data.sites.items;
|
|
77
|
-
return sites.length ? sites.concat([laterSite]) : sites;
|
|
78
|
-
} catch (e) {
|
|
79
|
-
throw (0, _errors.formatErrorMessage)(e, 'fetching your static sites');
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const createPersonalAccessTokenMutation = (0, _graphql.graphQLQuery)(`
|
|
84
|
-
mutation ($name: String!){
|
|
85
|
-
result: tsCreatePersonalAccessToken(name: $name) {
|
|
86
|
-
accessToken
|
|
87
|
-
id
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
`);
|
|
91
|
-
exports.createPersonalAccessTokenMutation = createPersonalAccessTokenMutation;
|
|
92
|
-
const createReadOnlyApiKeyMutation = (0, _graphql.graphQLQuery)(`
|
|
93
|
-
mutation ($name: String!){
|
|
94
|
-
result: tsCreateApiKey(name: $name role: "read") {
|
|
95
|
-
id
|
|
96
|
-
apiKey
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
`);
|
|
100
|
-
exports.createReadOnlyApiKeyMutation = createReadOnlyApiKeyMutation;
|
|
101
|
-
const deletePersonalAccessTokenMutation = (0, _graphql.graphQLQuery)(`
|
|
102
|
-
mutation ($id: ID!){
|
|
103
|
-
result: tsDeletePersonalAccessToken(id: $id)
|
|
104
|
-
}
|
|
105
|
-
`);
|
|
106
|
-
exports.deletePersonalAccessTokenMutation = deletePersonalAccessTokenMutation;
|
|
107
|
-
const deleteApiKeyMutation = (0, _graphql.graphQLQuery)(`
|
|
108
|
-
mutation ($id: ID!){
|
|
109
|
-
result: tsDeleteApiKey(id: $id)
|
|
110
|
-
}
|
|
111
|
-
`);
|
|
112
|
-
exports.deleteApiKeyMutation = deleteApiKeyMutation;
|
|
113
|
-
|
|
114
|
-
function createKeyName() {
|
|
115
|
-
return `TakeShape CLI ${_os.default.hostname()} ${new Date().toISOString().split('T')[0]}`;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async function createPersonalAccessToken(params, userJwt) {
|
|
119
|
-
try {
|
|
120
|
-
const client = (0, _graphql.createAdminConnector)(params, userJwt);
|
|
121
|
-
return await createPersonalAccessTokenMutation(client, {
|
|
122
|
-
name: createKeyName()
|
|
123
|
-
});
|
|
124
|
-
} catch (e) {
|
|
125
|
-
throw (0, _errors.formatErrorMessage)(e, 'creating your personal access token');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
async function deletePersonalAccessToken(params) {
|
|
130
|
-
try {
|
|
131
|
-
const client = (0, _graphql.createAdminConnector)(params, params.authToken);
|
|
132
|
-
|
|
133
|
-
if (params.personalAccessTokenId) {
|
|
134
|
-
return await deletePersonalAccessTokenMutation(client, {
|
|
135
|
-
id: params.personalAccessTokenId
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
throw new Error('personalAccessTokenId is required');
|
|
140
|
-
} catch (e) {
|
|
141
|
-
throw (0, _errors.formatErrorMessage)(e, 'deleting your personal access token');
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
async function createReadOnlyApiKey(params, pathParams) {
|
|
146
|
-
try {
|
|
147
|
-
const client = (0, _graphql.createAdminConnector)(params, params.authToken, pathParams);
|
|
148
|
-
return await createReadOnlyApiKeyMutation(client, {
|
|
149
|
-
name: createKeyName()
|
|
150
|
-
});
|
|
151
|
-
} catch (e) {
|
|
152
|
-
throw (0, _errors.formatErrorMessage)(e, 'creating your read-only api key');
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
async function deleteApiKey(params, pathParams, apiKeyId) {
|
|
157
|
-
try {
|
|
158
|
-
const client = (0, _graphql.createAdminConnector)(params, params.authToken, pathParams);
|
|
159
|
-
return await deleteApiKeyMutation(client, {
|
|
160
|
-
id: apiKeyId
|
|
161
|
-
});
|
|
162
|
-
} catch (e) {
|
|
163
|
-
throw (0, _errors.formatErrorMessage)(e, 'deleting your api key');
|
|
164
|
-
}
|
|
165
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fatal-error.d.ts","sourceRoot":"","sources":["../../../src/util/fatal-error.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAGjD"}
|
package/dist/util/fatal-error.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.fatalError = fatalError;
|
|
7
|
-
|
|
8
|
-
var _log = _interopRequireDefault(require("../log"));
|
|
9
|
-
|
|
10
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function fatalError(message) {
|
|
15
|
-
(0, _log.default)(_chalk.default.red('Error'), message);
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-error.d.ts","sourceRoot":"","sources":["../../../src/util/format-error.js"],"names":[],"mappings":"AAAA,qDAEC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ProjectSchemaImportValidationResult, SchemaValidationResult } from '@takeshape/schema';
|
|
2
|
-
export declare function formatValidationResult(schemaValidationResult: SchemaValidationResult | ProjectSchemaImportValidationResult): string | undefined;
|
|
3
|
-
//# sourceMappingURL=format-validation-result.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-validation-result.d.ts","sourceRoot":"","sources":["../../../src/util/format-validation-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mCAAmC,EAAE,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;AAE9F,wBAAgB,sBAAsB,CACpC,sBAAsB,EAAE,sBAAsB,GAAG,mCAAmC,GACnF,MAAM,GAAG,SAAS,CAKpB"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.formatValidationResult = formatValidationResult;
|
|
7
|
-
|
|
8
|
-
function formatValidationResult(schemaValidationResult) {
|
|
9
|
-
const {
|
|
10
|
-
valid,
|
|
11
|
-
errors
|
|
12
|
-
} = schemaValidationResult;
|
|
13
|
-
|
|
14
|
-
if (!valid && errors) {
|
|
15
|
-
return `Invalid schema:\n ${errors.map(e => `${e.type}: ${e.message} at ${e.path.join('/')}`).join('\n ')}`;
|
|
16
|
-
}
|
|
17
|
-
}
|
package/dist/util/fs.d.ts
DELETED
package/dist/util/fs.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/util/fs.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;;;EAerE"}
|
package/dist/util/fs.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.resolveFromFlag = resolveFromFlag;
|
|
7
|
-
|
|
8
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
9
|
-
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function resolveFromFlag(from, expectedFilename) {
|
|
15
|
-
if (!_fsExtra.default.existsSync(from)) {
|
|
16
|
-
return {
|
|
17
|
-
exists: false,
|
|
18
|
-
file: from
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (_fsExtra.default.lstatSync(from).isFile()) {
|
|
23
|
-
return {
|
|
24
|
-
exists: true,
|
|
25
|
-
file: from
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const file = _path.default.join(from, expectedFilename);
|
|
30
|
-
|
|
31
|
-
if (_fsExtra.default.existsSync(file) && _fsExtra.default.lstatSync(file).isFile()) {
|
|
32
|
-
return {
|
|
33
|
-
exists: true,
|
|
34
|
-
file
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
exists: false,
|
|
40
|
-
file
|
|
41
|
-
};
|
|
42
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** Uses [GraphQL Code Generator](https://www.graphql-code-generator.com/)
|
|
2
|
-
* to create TypeScript definitions from a GraphQL schema file.
|
|
3
|
-
*/
|
|
4
|
-
export declare function generateTypes(schemaFile: string, outputFile: string): Promise<void>;
|
|
5
|
-
//# sourceMappingURL=generate-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-types.d.ts","sourceRoot":"","sources":["../../../src/util/generate-types.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,wBAAsB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BzF"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateTypes = generateTypes;
|
|
7
|
-
|
|
8
|
-
var _fsExtra = require("fs-extra");
|
|
9
|
-
|
|
10
|
-
var _path = require("path");
|
|
11
|
-
|
|
12
|
-
var _graphql = require("graphql");
|
|
13
|
-
|
|
14
|
-
var _core = require("@graphql-codegen/core");
|
|
15
|
-
|
|
16
|
-
var typescriptPlugin = _interopRequireWildcard(require("@graphql-codegen/typescript"));
|
|
17
|
-
|
|
18
|
-
var _load = require("@graphql-tools/load");
|
|
19
|
-
|
|
20
|
-
var _graphqlFileLoader = require("@graphql-tools/graphql-file-loader");
|
|
21
|
-
|
|
22
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
23
|
-
|
|
24
|
-
var _log = _interopRequireDefault(require("../log"));
|
|
25
|
-
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
-
|
|
32
|
-
/** Uses [GraphQL Code Generator](https://www.graphql-code-generator.com/)
|
|
33
|
-
* to create TypeScript definitions from a GraphQL schema file.
|
|
34
|
-
*/
|
|
35
|
-
async function generateTypes(schemaFile, outputFile) {
|
|
36
|
-
(0, _log.default)(`Generating types from ${schemaFile}…`);
|
|
37
|
-
const origin = (0, _path.join)(process.cwd(), schemaFile);
|
|
38
|
-
const destination = (0, _path.join)(process.cwd(), outputFile);
|
|
39
|
-
const schema = await (0, _load.loadSchema)(origin, {
|
|
40
|
-
loaders: [new _graphqlFileLoader.GraphQLFileLoader()]
|
|
41
|
-
});
|
|
42
|
-
const config = {
|
|
43
|
-
documents: [],
|
|
44
|
-
config: {},
|
|
45
|
-
// used by a plugin internally, although the 'typescript' plugin currently
|
|
46
|
-
// returns the string output, rather than writing to a file
|
|
47
|
-
filename: outputFile,
|
|
48
|
-
schema: (0, _graphql.parse)((0, _graphql.printSchema)(schema)),
|
|
49
|
-
plugins: [// Each plugin should be an object
|
|
50
|
-
{
|
|
51
|
-
typescript: {} // Here you can pass configuration to the plugin
|
|
52
|
-
|
|
53
|
-
}],
|
|
54
|
-
pluginMap: {
|
|
55
|
-
typescript: typescriptPlugin
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const output = await (0, _core.codegen)(config);
|
|
59
|
-
await (0, _fsExtra.ensureFile)(destination);
|
|
60
|
-
(0, _fsExtra.writeFile)(destination, output, () => {
|
|
61
|
-
(0, _log.default)(_chalk.default.green(`Success!`), `Saved generated types to ${outputFile}`);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-client-schema.d.ts","sourceRoot":"","sources":["../../../src/util/get-client-schema.js"],"names":[],"mappings":"AAMA,+DAMC;AARD,2DAA4D"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.SCHEMA_FILE_NAME = void 0;
|
|
7
|
-
exports.getClientSchema = getClientSchema;
|
|
8
|
-
|
|
9
|
-
var _graphql = require("graphql");
|
|
10
|
-
|
|
11
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
12
|
-
|
|
13
|
-
var _oraWrapper = _interopRequireDefault(require("./ora-wrapper"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
const SCHEMA_FILE_NAME = 'takeshape-project.graphql';
|
|
18
|
-
exports.SCHEMA_FILE_NAME = SCHEMA_FILE_NAME;
|
|
19
|
-
|
|
20
|
-
async function getClientSchema(connector) {
|
|
21
|
-
const res = await connector({
|
|
22
|
-
query: (0, _graphql.getIntrospectionQuery)()
|
|
23
|
-
});
|
|
24
|
-
const schema = (0, _graphql.buildClientSchema)(res.data);
|
|
25
|
-
const result = (0, _graphql.printSchema)(schema);
|
|
26
|
-
await _fsExtra.default.writeFile(SCHEMA_FILE_NAME, result);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var _default = (0, _oraWrapper.default)(getClientSchema, 'Getting client schema.', `Client schema saved as ${SCHEMA_FILE_NAME}.`, 'Failed while getting client schema.');
|
|
30
|
-
|
|
31
|
-
exports.default = _default;
|
package/dist/util/glitch.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glitch.d.ts","sourceRoot":"","sources":["../../../src/util/glitch.js"],"names":[],"mappings":"AAKA,oCAEC;AAMD,2CAOC;AAED,qDAEC;AAED,kFAUC"}
|