UNPKG

774 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var chalk_1 = require("chalk");
4var crypto = require("crypto");
5var path = require("path");
6var os = require("os");
7exports.noEndpointError = new Error("You don't have any endpoint in your .graphqlconfig.\nRun " + chalk_1.default.yellow('graphql add-endpoint') + " to add an endpoint to your config");
8function randomString(len) {
9 if (len === void 0) { len = 32; }
10 return crypto
11 .randomBytes(Math.ceil(len * 3 / 4))
12 .toString('base64')
13 .slice(0, len)
14 .replace(/\+/g, '0')
15 .replace(/\//g, '0');
16}
17function getTmpPath() {
18 return path.join(os.tmpdir(), randomString() + ".json");
19}
20exports.getTmpPath = getTmpPath;
21//# sourceMappingURL=utils.js.map
\No newline at end of file