1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var chalk_1 = require("chalk");
|
4 | var crypto = require("crypto");
|
5 | var path = require("path");
|
6 | var os = require("os");
|
7 | exports.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");
|
8 | function 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 | }
|
17 | function getTmpPath() {
|
18 | return path.join(os.tmpdir(), randomString() + ".json");
|
19 | }
|
20 | exports.getTmpPath = getTmpPath;
|
21 |
|
\ | No newline at end of file |