@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/commands/schema.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _linkedCommand = require("../util/linked-command");
|
|
9
|
-
|
|
10
|
-
var _connector = require("../util/connector");
|
|
11
|
-
|
|
12
|
-
var _getClientSchema = _interopRequireDefault(require("../util/get-client-schema"));
|
|
13
|
-
|
|
14
|
-
var _branches = require("../util/branches");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
|
|
19
|
-
const connector = (0, _connector.createConnector)(params, (0, _branches.getBranchParams)(cli), {
|
|
20
|
-
cache: false
|
|
21
|
-
});
|
|
22
|
-
await (0, _getClientSchema.default)(connector);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":";AAGA,wBAEG"}
|
package/dist/commands/status.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _linkedCommand = require("../util/linked-command");
|
|
9
|
-
|
|
10
|
-
var _log = _interopRequireDefault(require("../log"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
var _default = (0, _linkedCommand.linkedCommand)(async (cli, params) => {
|
|
15
|
-
(0, _log.default)(`Project: ${params.projectName} \nStatic Site: ${params.siteName ?? 'not configured'}`);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
exports.default = _default;
|
package/dist/commands/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/types.ts"],"names":[],"mappings":";AAeA,wBAGG"}
|
package/dist/commands/types.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _linkedCommand = require("../util/linked-command");
|
|
9
|
-
|
|
10
|
-
var _generateTypes = require("../util/generate-types");
|
|
11
|
-
|
|
12
|
-
var _getClientSchema = require("../util/get-client-schema");
|
|
13
|
-
|
|
14
|
-
const DEFAULT_GENERATED_FILE = './takeshape.d.ts';
|
|
15
|
-
/*
|
|
16
|
-
takeshape types --to ./takeshape.d.ts
|
|
17
|
-
|
|
18
|
-
Generate TypeScript types from your TakeShape schema.
|
|
19
|
-
|
|
20
|
-
Options:
|
|
21
|
-
--in: if provided, will generate types used
|
|
22
|
-
--to: the path to save the download or the full file path, defaults to current directory
|
|
23
|
-
*/
|
|
24
|
-
|
|
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
|
-
});
|
|
29
|
-
|
|
30
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _log = _interopRequireDefault(require("../log"));
|
|
9
|
-
|
|
10
|
-
var _types = require("../types");
|
|
11
|
-
|
|
12
|
-
var _config = require("../config");
|
|
13
|
-
|
|
14
|
-
var _data = require("../util/data");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
const unlink = async (_, params) => {
|
|
19
|
-
try {
|
|
20
|
-
if ((0, _types.isLoggedInAndLinkedConfig)(params)) {
|
|
21
|
-
await (0, _data.deleteApiKey)(params, params.projectId, params.linkedApiKey.id);
|
|
22
|
-
(0, _config.deleteLinkedConfig)();
|
|
23
|
-
}
|
|
24
|
-
} catch (e) {
|
|
25
|
-
(0, _log.default)(e);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
var _default = unlink;
|
|
30
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
9
|
-
|
|
10
|
-
var _log = _interopRequireDefault(require("../log"));
|
|
11
|
-
|
|
12
|
-
var _fatalError = require("../util/fatal-error");
|
|
13
|
-
|
|
14
|
-
var _path = _interopRequireDefault(require("path"));
|
|
15
|
-
|
|
16
|
-
var _formatValidationResult = require("../util/format-validation-result");
|
|
17
|
-
|
|
18
|
-
var _schema = require("@takeshape/schema");
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
|
-
const validate = async cli => {
|
|
23
|
-
const {
|
|
24
|
-
flags
|
|
25
|
-
} = cli;
|
|
26
|
-
let schemaPath;
|
|
27
|
-
|
|
28
|
-
if (flags.path) {
|
|
29
|
-
if (_fsExtra.default.existsSync(flags.path) && _fsExtra.default.statSync(flags.path).isDirectory()) {
|
|
30
|
-
schemaPath = _path.default.join(flags.path, 'schema.json');
|
|
31
|
-
} else {
|
|
32
|
-
schemaPath = flags.path;
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
schemaPath = _path.default.join('.', 'schema.json');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (!_fsExtra.default.existsSync(schemaPath)) {
|
|
39
|
-
return (0, _fatalError.fatalError)(`${schemaPath} does not exist. You can download a project schema with 'takeshape export --schema'` + ` or specify a path with 'takeshape validate --path=/path/to/schema.json'`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
const schema = JSON.parse(_fsExtra.default.readFileSync(schemaPath).toString());
|
|
44
|
-
const validationString = (0, _formatValidationResult.formatValidationResult)((0, _schema.validateSchema)(schema));
|
|
45
|
-
|
|
46
|
-
if (validationString) {
|
|
47
|
-
return (0, _fatalError.fatalError)(validationString);
|
|
48
|
-
}
|
|
49
|
-
} catch (e) {
|
|
50
|
-
return (0, _fatalError.fatalError)(e.message);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
(0, _log.default)(`${schemaPath} is valid.`);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
var _default = validate;
|
|
57
|
-
exports.default = _default;
|
package/dist/config.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CliConfig } from './types';
|
|
2
|
-
import { Choice } from './prompt';
|
|
3
|
-
import { ApiKey, PersonalAccessToken } from './util/data';
|
|
4
|
-
import meow, { AnyFlags } from 'meow';
|
|
5
|
-
export declare const TAKESHAPE_CONFIG_FILENAME = ".takeshaperc";
|
|
6
|
-
export declare const GRAPHQL_CONFIG_FILENAME = ".graphqlconfig";
|
|
7
|
-
export declare function getHomeConfigPath(): string;
|
|
8
|
-
export declare function loadConfig(cwd: string, cli: meow.Result<AnyFlags>): CliConfig;
|
|
9
|
-
export declare function writeLinkedProjectConfig(params: CliConfig, linkedApiKey: ApiKey, project: Choice, site: Choice | undefined): Promise<void>;
|
|
10
|
-
export declare function deleteLinkedConfig(): void;
|
|
11
|
-
export declare function writeHomeConfig(accessToken: PersonalAccessToken): Promise<void>;
|
|
12
|
-
export declare function deleteHomeConfig(): void;
|
|
13
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAOlC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,MAAM,EAAE,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAExD,OAAO,IAAI,EAAE,EAAC,QAAQ,EAAC,MAAM,MAAM,CAAC;AAEpC,eAAO,MAAM,yBAAyB,iBAAiB,CAAC;AACxD,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CA8B7E;AAWD,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED,wBAAgB,kBAAkB,SAQjC;AAED,wBAAsB,eAAe,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAIrF;AAED,wBAAgB,gBAAgB,SAK/B"}
|
package/dist/config.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TAKESHAPE_CONFIG_FILENAME = exports.GRAPHQL_CONFIG_FILENAME = void 0;
|
|
7
|
-
exports.deleteHomeConfig = deleteHomeConfig;
|
|
8
|
-
exports.deleteLinkedConfig = deleteLinkedConfig;
|
|
9
|
-
exports.getHomeConfigPath = getHomeConfigPath;
|
|
10
|
-
exports.loadConfig = loadConfig;
|
|
11
|
-
exports.writeHomeConfig = writeHomeConfig;
|
|
12
|
-
exports.writeLinkedProjectConfig = writeLinkedProjectConfig;
|
|
13
|
-
|
|
14
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
15
|
-
|
|
16
|
-
var _path = _interopRequireDefault(require("path"));
|
|
17
|
-
|
|
18
|
-
var _os = _interopRequireDefault(require("os"));
|
|
19
|
-
|
|
20
|
-
var _isDocker = _interopRequireDefault(require("is-docker"));
|
|
21
|
-
|
|
22
|
-
var _messages = require("./util/messages");
|
|
23
|
-
|
|
24
|
-
var _graphql = require("./graphql");
|
|
25
|
-
|
|
26
|
-
var _api = require("./util/api");
|
|
27
|
-
|
|
28
|
-
var _connector = require("./util/connector");
|
|
29
|
-
|
|
30
|
-
var _getClientSchema = _interopRequireDefault(require("./util/get-client-schema"));
|
|
31
|
-
|
|
32
|
-
var _ignore = _interopRequireDefault(require("ignore"));
|
|
33
|
-
|
|
34
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
-
|
|
36
|
-
const TAKESHAPE_CONFIG_FILENAME = '.takeshaperc';
|
|
37
|
-
exports.TAKESHAPE_CONFIG_FILENAME = TAKESHAPE_CONFIG_FILENAME;
|
|
38
|
-
const GRAPHQL_CONFIG_FILENAME = '.graphqlconfig';
|
|
39
|
-
exports.GRAPHQL_CONFIG_FILENAME = GRAPHQL_CONFIG_FILENAME;
|
|
40
|
-
|
|
41
|
-
function getHomeConfigPath() {
|
|
42
|
-
return _path.default.join(_os.default.homedir(), TAKESHAPE_CONFIG_FILENAME);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function loadConfig(cwd, cli) {
|
|
46
|
-
let config = {};
|
|
47
|
-
|
|
48
|
-
const configPath = _path.default.join(cwd, TAKESHAPE_CONFIG_FILENAME);
|
|
49
|
-
|
|
50
|
-
if (_fsExtra.default.existsSync(configPath)) {
|
|
51
|
-
config = _fsExtra.default.readJsonSync(configPath);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const homeConfigPath = getHomeConfigPath();
|
|
55
|
-
|
|
56
|
-
if (_fsExtra.default.existsSync(homeConfigPath)) {
|
|
57
|
-
const homeConfig = _fsExtra.default.readJsonSync(homeConfigPath);
|
|
58
|
-
|
|
59
|
-
config.authToken = homeConfig.accessToken;
|
|
60
|
-
config.personalAccessTokenId = homeConfig.id;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
buildPath: _path.default.join(cwd, cli.flags.output ?? 'build'),
|
|
65
|
-
configFilePath: _path.default.join(cwd, cli.flags.file ?? 'tsg.yml'),
|
|
66
|
-
appUrl: process.env.TS_APP_URL ?? config.appUrl ?? 'https://app.takeshape.io',
|
|
67
|
-
endpoint: process.env.TS_API_ENDPOINT ?? config.endpoint ?? 'https://api.takeshape.io',
|
|
68
|
-
authToken: cli.flags.token ?? process.env.TS_AUTH_TOKEN ?? config.authToken,
|
|
69
|
-
personalAccessTokenId: config.personalAccessTokenId,
|
|
70
|
-
linkedApiKey: process.env.TS_API_KEY ? {
|
|
71
|
-
id: 'TS_API_KEY',
|
|
72
|
-
apiKey: process.env.TS_API_KEY
|
|
73
|
-
} : config.linkedApiKey,
|
|
74
|
-
cliLogin: Boolean(cli.flags.cliLogin) || (0, _isDocker.default)() || Boolean(process.env.GITHUB_ACTIONS),
|
|
75
|
-
siteId: cli.flags.site ?? process.env.TS_SITE_ID ?? config.siteId,
|
|
76
|
-
projectName: process.env.TS_PROJECT_NAME ?? config.projectName,
|
|
77
|
-
projectId: process.env.TS_PROJECT_ID ?? config.projectId,
|
|
78
|
-
siteName: process.env.TS_SITE_NAME ?? config.siteName,
|
|
79
|
-
cache: Boolean(cli.flags.cache),
|
|
80
|
-
watchContent: Boolean(cli.flags.watchContent)
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function gitignores(files) {
|
|
85
|
-
if (_fsExtra.default.existsSync('.gitignore')) {
|
|
86
|
-
const ig = (0, _ignore.default)().add(_fsExtra.default.readFileSync('.gitignore', 'utf8'));
|
|
87
|
-
return ig.filter(files).length === 0;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
async function writeLinkedProjectConfig(params, linkedApiKey, project, site) {
|
|
94
|
-
(0, _messages.writingFilesMsg)();
|
|
95
|
-
|
|
96
|
-
if (!gitignores([GRAPHQL_CONFIG_FILENAME, TAKESHAPE_CONFIG_FILENAME])) {
|
|
97
|
-
(0, _messages.consoleWarning)();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const graphqlEndpoint = (0, _graphql.getGraphQLEndpoint)(params, project.value);
|
|
101
|
-
const takeshaperc = {
|
|
102
|
-
projectId: project.value,
|
|
103
|
-
siteId: site === null || site === void 0 ? void 0 : site.value,
|
|
104
|
-
siteName: site === null || site === void 0 ? void 0 : site.name,
|
|
105
|
-
endpoint: params.endpoint,
|
|
106
|
-
appUrl: params.appUrl,
|
|
107
|
-
projectName: project.name,
|
|
108
|
-
linkedApiKey
|
|
109
|
-
};
|
|
110
|
-
const options = {
|
|
111
|
-
headers: {
|
|
112
|
-
'Content-Type': 'application/json',
|
|
113
|
-
...(0, _api.getAuthHeader)(linkedApiKey.apiKey)
|
|
114
|
-
},
|
|
115
|
-
introspect: true
|
|
116
|
-
};
|
|
117
|
-
const graphqlConfigJson = {
|
|
118
|
-
schemaPath: 'takeshape-project.graphql',
|
|
119
|
-
includes: ['**/*.graphql'],
|
|
120
|
-
excludes: ['node_modules/**/*.graphql'],
|
|
121
|
-
extensions: {
|
|
122
|
-
endpoints: {
|
|
123
|
-
TakeShape: {
|
|
124
|
-
url: graphqlEndpoint,
|
|
125
|
-
...options
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
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
|
-
...takeshaperc
|
|
132
|
-
}, {
|
|
133
|
-
environment: 'PRODUCTION'
|
|
134
|
-
}, {
|
|
135
|
-
cache: false
|
|
136
|
-
}))]);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function deleteLinkedConfig() {
|
|
140
|
-
if (_fsExtra.default.existsSync(GRAPHQL_CONFIG_FILENAME)) {
|
|
141
|
-
_fsExtra.default.removeSync(GRAPHQL_CONFIG_FILENAME);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (_fsExtra.default.existsSync(TAKESHAPE_CONFIG_FILENAME)) {
|
|
145
|
-
_fsExtra.default.removeSync(TAKESHAPE_CONFIG_FILENAME);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
async function writeHomeConfig(accessToken) {
|
|
150
|
-
const configPath = getHomeConfigPath();
|
|
151
|
-
await _fsExtra.default.writeJSON(configPath, accessToken);
|
|
152
|
-
(0, _messages.writingHomeConfigDoneMsg)(configPath);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function deleteHomeConfig() {
|
|
156
|
-
const homeConfigPath = getHomeConfigPath();
|
|
157
|
-
|
|
158
|
-
if (_fsExtra.default.existsSync(homeConfigPath)) {
|
|
159
|
-
_fsExtra.default.removeSync(homeConfigPath);
|
|
160
|
-
}
|
|
161
|
-
}
|
package/dist/deprecated.d.ts
DELETED
package/dist/deprecated.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../../src/deprecated.ts"],"names":[],"mappings":""}
|
package/dist/deprecated.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _log = _interopRequireDefault(require("./log"));
|
|
4
|
-
|
|
5
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
6
|
-
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
-
|
|
9
|
-
(0, _log.default)(`${_chalk.default.red('Error:')} The "tsg" command has been deprecated. Use "takeshape" instead`);
|
package/dist/errors.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare class HTTPError extends Error {
|
|
2
|
-
statusCode: number;
|
|
3
|
-
constructor(message: string, statusCode: number);
|
|
4
|
-
}
|
|
5
|
-
export declare function formatErrorMessage(error: Error | HTTPError, activity: string): Error;
|
|
6
|
-
export declare function handleHttpErrors(error: Error | HTTPError, activity: string): void;
|
|
7
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;IAC3B,UAAU,EAAE,MAAM,CAAC;gBACP,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAIvD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAcpF;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEjF"}
|
package/dist/errors.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.HTTPError = void 0;
|
|
7
|
-
exports.formatErrorMessage = formatErrorMessage;
|
|
8
|
-
exports.handleHttpErrors = handleHttpErrors;
|
|
9
|
-
|
|
10
|
-
class HTTPError extends Error {
|
|
11
|
-
constructor(message, statusCode) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.statusCode = statusCode;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
exports.HTTPError = HTTPError;
|
|
19
|
-
|
|
20
|
-
function formatErrorMessage(error, activity) {
|
|
21
|
-
if ('statusCode' in error) {
|
|
22
|
-
if (error.statusCode === 401 || error.statusCode === 403) {
|
|
23
|
-
return new Error('Insufficient Permissions to develop with TakeShape CLI. Your account must have the "Admin" role or better.');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (error.statusCode === 500) {
|
|
27
|
-
return new Error(`A Server error occurred while ${activity}.`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return error;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function handleHttpErrors(error, activity) {
|
|
35
|
-
throw formatErrorMessage(error, activity);
|
|
36
|
-
}
|
package/dist/files.d.ts
DELETED
package/dist/files.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/files.js"],"names":[],"mappings":"AAKA,uDAIC;AAED,+EAgBC;AAED,qEAOC"}
|
package/dist/files.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.copyStatic = copyStatic;
|
|
7
|
-
exports.syncStatic = syncStatic;
|
|
8
|
-
exports.writePages = writePages;
|
|
9
|
-
|
|
10
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
11
|
-
|
|
12
|
-
var _path = _interopRequireDefault(require("path"));
|
|
13
|
-
|
|
14
|
-
var _bluebird = _interopRequireDefault(require("bluebird"));
|
|
15
|
-
|
|
16
|
-
var _log = _interopRequireDefault(require("./log"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
async function copyStatic(config) {
|
|
21
|
-
return _fsExtra.default.mkdirs(config.buildPath).then(async () => _fsExtra.default.copy(config.staticPath, config.buildPath, {
|
|
22
|
-
preserveTimestamps: true
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function syncStatic(config) {
|
|
27
|
-
return (event, sourcePath) => {
|
|
28
|
-
const relativePath = sourcePath.replace(config.staticPath, '');
|
|
29
|
-
|
|
30
|
-
const destPath = _path.default.join(config.buildPath, relativePath);
|
|
31
|
-
|
|
32
|
-
if (event === 'addDir') {
|
|
33
|
-
(0, _log.default)('takeshape watch - copied ' + relativePath);
|
|
34
|
-
|
|
35
|
-
_fsExtra.default.mkdirs(destPath);
|
|
36
|
-
} else if (event === 'unlink' || event === 'unlinkDir') {
|
|
37
|
-
(0, _log.default)('takeshape watch - deleted ' + relativePath);
|
|
38
|
-
|
|
39
|
-
_fsExtra.default.remove(destPath);
|
|
40
|
-
} else {
|
|
41
|
-
(0, _log.default)('takeshape watch - copied ' + relativePath);
|
|
42
|
-
|
|
43
|
-
_fsExtra.default.copy(sourcePath, destPath);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function writePages(outputPath) {
|
|
49
|
-
return generated => {
|
|
50
|
-
return _bluebird.default.map(generated.pages, async page => {
|
|
51
|
-
const filePath = _path.default.join(outputPath, page.path);
|
|
52
|
-
|
|
53
|
-
return _fsExtra.default.mkdirs(_path.default.dirname(filePath)).then(async () => _fsExtra.default.writeFile(filePath, page.contents, 'utf8'));
|
|
54
|
-
}).then(() => generated.stats);
|
|
55
|
-
};
|
|
56
|
-
}
|
package/dist/graphql.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Client, CliConfig } from './types';
|
|
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;
|
|
10
|
-
export declare const getGraphQLEndpoint: GetGraphQLEndpoint;
|
|
11
|
-
export declare const getGraphQLAdminEndpoint: GetGraphQLEndpoint;
|
|
12
|
-
export interface GraphQLConnectorOptions {
|
|
13
|
-
retries?: number;
|
|
14
|
-
timeout?: number;
|
|
15
|
-
cache?: boolean;
|
|
16
|
-
branch?: BranchParams;
|
|
17
|
-
}
|
|
18
|
-
export declare const createConnectorFactory: (getGraphQLEndpoint: GetGraphQLEndpoint) => (params: CliConfig, authToken: string, pathParams?: PathParams, options?: GraphQLConnectorOptions) => Client;
|
|
19
|
-
export declare const createConnector: (params: CliConfig, authToken: string, pathParams?: PathParams, options?: GraphQLConnectorOptions) => Client;
|
|
20
|
-
export declare const createAdminConnector: (params: CliConfig, authToken: string, pathParams?: PathParams, options?: GraphQLConnectorOptions) => Client;
|
|
21
|
-
export declare function graphQLQuery<Variables extends Record<string, unknown>, Data>(query: string): (client: Client, variables: Variables) => Promise<Data>;
|
|
22
|
-
//# sourceMappingURL=graphql.d.ts.map
|
package/dist/graphql.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/graphql.ts"],"names":[],"mappings":"AAKA,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;AAgBvF,eAAO,MAAM,kBAAkB,oBAA8C,CAAC;AAC9E,eAAO,MAAM,uBAAuB,oBAAqD,CAAC;AAE1F,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,YAAY,uBAAuB,KAAG,MAkCnG,CAAC;AAEJ,eAAO,MAAM,eAAe,WApCjB,SAAS,aAAa,MAAM,eAAe,UAAU,YAAY,uBAAuB,KAAG,MAoC7B,CAAC;AAC1E,eAAO,MAAM,oBAAoB,WArCtB,SAAS,aAAa,MAAM,eAAe,UAAU,YAAY,uBAAuB,KAAG,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
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getGraphQLEndpoint = exports.getGraphQLAdminEndpoint = exports.createConnectorFactory = exports.createConnector = exports.createAdminConnector = void 0;
|
|
7
|
-
exports.graphQLQuery = graphQLQuery;
|
|
8
|
-
|
|
9
|
-
var _branches = require("@takeshape/branches");
|
|
10
|
-
|
|
11
|
-
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
12
|
-
|
|
13
|
-
var _asyncRetry = _interopRequireDefault(require("async-retry"));
|
|
14
|
-
|
|
15
|
-
var _errors = require("./errors");
|
|
16
|
-
|
|
17
|
-
var _api = require("./util/api");
|
|
18
|
-
|
|
19
|
-
var _branches2 = require("./util/branches");
|
|
20
|
-
|
|
21
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
|
|
23
|
-
const getGraphQLEndpointFactory = (path, useBranch) => (params, pathParams) => {
|
|
24
|
-
const projectId = typeof pathParams === 'object' ? pathParams.projectId : pathParams;
|
|
25
|
-
const branchParams = typeof pathParams === 'object' ? pathParams : {
|
|
26
|
-
environment: _branches.BRANCH_ENVIRONMENT_PRODUCTION_ENUM
|
|
27
|
-
};
|
|
28
|
-
const basePath = projectId ? useBranch ? (0, _branches2.getBranchBasePath)(branchParams, projectId) : `/project/${projectId}` : '';
|
|
29
|
-
return `${params.endpoint}${basePath}${path}`;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const getGraphQLEndpoint = getGraphQLEndpointFactory('/graphql', true);
|
|
33
|
-
exports.getGraphQLEndpoint = getGraphQLEndpoint;
|
|
34
|
-
const getGraphQLAdminEndpoint = getGraphQLEndpointFactory('/admin-graphql', false);
|
|
35
|
-
exports.getGraphQLAdminEndpoint = getGraphQLAdminEndpoint;
|
|
36
|
-
const defaultOptions = {
|
|
37
|
-
retries: 3,
|
|
38
|
-
timeout: 0
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const createConnectorFactory = getGraphQLEndpoint => (params, authToken, pathParams, options) => {
|
|
42
|
-
const endpoint = getGraphQLEndpoint(params, pathParams ?? {
|
|
43
|
-
environment: _branches.BRANCH_ENVIRONMENT_PRODUCTION_ENUM
|
|
44
|
-
});
|
|
45
|
-
const authHeader = (0, _api.getAuthHeader)(authToken);
|
|
46
|
-
const {
|
|
47
|
-
timeout,
|
|
48
|
-
retries
|
|
49
|
-
} = { ...defaultOptions,
|
|
50
|
-
...options
|
|
51
|
-
};
|
|
52
|
-
return async params => (0, _asyncRetry.default)(async bail => {
|
|
53
|
-
const res = await (0, _nodeFetch.default)(endpoint, {
|
|
54
|
-
method: 'POST',
|
|
55
|
-
timeout,
|
|
56
|
-
body: JSON.stringify(params),
|
|
57
|
-
headers: {
|
|
58
|
-
'Content-Type': 'application/json',
|
|
59
|
-
...authHeader
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
const body = await res.json();
|
|
63
|
-
|
|
64
|
-
if (res.ok) {
|
|
65
|
-
return body;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const error = new _errors.HTTPError(`${res.statusText}: ${body.message}`, res.status);
|
|
69
|
-
|
|
70
|
-
if (res.status === 401 || res.status === 403) {
|
|
71
|
-
// Bail to stop retrying
|
|
72
|
-
bail(error);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
throw error;
|
|
77
|
-
}, {
|
|
78
|
-
retries
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
exports.createConnectorFactory = createConnectorFactory;
|
|
83
|
-
const createConnector = createConnectorFactory(getGraphQLEndpoint);
|
|
84
|
-
exports.createConnector = createConnector;
|
|
85
|
-
const createAdminConnector = createConnectorFactory(getGraphQLAdminEndpoint);
|
|
86
|
-
exports.createAdminConnector = createAdminConnector;
|
|
87
|
-
|
|
88
|
-
function graphQLQuery(query) {
|
|
89
|
-
return async (client, variables) => {
|
|
90
|
-
const {
|
|
91
|
-
data,
|
|
92
|
-
errors
|
|
93
|
-
} = await client({
|
|
94
|
-
query,
|
|
95
|
-
variables
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
if (errors) {
|
|
99
|
-
throw new Error(errors.map(error => error.message).join(', '));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return data.result;
|
|
103
|
-
};
|
|
104
|
-
}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|