UNPKG

firebase-app-distribution

Version:
76 lines (75 loc) 2.54 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; // src/utils.ts var utils_exports = {}; __export(utils_exports, { APP_DISTRIBUTION_ENDPOINT: () => APP_DISTRIBUTION_ENDPOINT, AUTH_SCOPES: () => AUTH_SCOPES, ENDPOINT_VERSION: () => ENDPOINT_VERSION, makeRequest: () => makeRequest }); module.exports = __toCommonJS(utils_exports); var APP_DISTRIBUTION_ENDPOINT = "https://firebaseappdistribution.googleapis.com"; var ENDPOINT_VERSION = "v1"; var AUTH_SCOPES = [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/firebase" ]; function makeRequest(input, init) { return __async(this, null, function* () { const response = yield fetch(input, init); if (response.status !== 200) { const errMessage = yield response.text(); throw new Error( `Request failed with status code ${response.status} and message: ${errMessage}` ); } const responseText = yield response.text(); const responseObj = JSON.parse(responseText); return responseObj; }); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { APP_DISTRIBUTION_ENDPOINT, AUTH_SCOPES, ENDPOINT_VERSION, makeRequest }); //# sourceMappingURL=utils.js.map