UNPKG

functional-google-cloud

Version:

Google Cloud Utilities functions in Functional Programming Style

44 lines 2.01 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.storage = exports.bucket = exports.file = exports.returnValues = exports.buffer = exports.path = exports.error = exports.config = void 0; const Stub = __importStar(require("./Stubs")); const fc = __importStar(require("fast-check")); const nonEmptyString = () => fc.hexaString(2, 16); const fileType = () => fc.constantFrom('pdf', 'excel', 'json'); exports.config = () => fc.record({ file_type: fileType(), expires_in: fc.nat(), }); exports.error = () => nonEmptyString().map((message) => new Error(message)); exports.path = () => fc.record({ bucket: nonEmptyString(), filename: nonEmptyString(), }); exports.buffer = () => fc.asciiString(8, 1024).map((content) => Buffer.from(content, 'ascii')); exports.returnValues = () => fc.record({ url: fc.webUrl(), buffer: exports.buffer(), }); exports.file = () => exports.returnValues().map(Stub.file); exports.bucket = () => exports.returnValues().map(Stub.bucket); exports.storage = (arb) => (arb || exports.returnValues()).map(Stub.storage); //# sourceMappingURL=Arbitraries.js.map