UNPKG

firebase-app-distribution

Version:
39 lines (37 loc) 1.02 kB
import { APP_DISTRIBUTION_ENDPOINT, ENDPOINT_VERSION, __async, makeRequest } from "./chunk-PTPJZ7KZ.mjs"; // src/releases/operations.ts function isValidOperationName(operationName) { const regex = /^projects\/[^/]+\/apps\/[^/]+\/releases\/[^/]+\/operations\/[^/]+$/; return regex.test(operationName); } var Operations = class { constructor(parent) { this.parent = parent; } get(operationName) { return __async(this, null, function* () { if (!isValidOperationName(operationName)) { throw new Error(`Invalid operation name: ${operationName}`); } const accessToken = yield this.parent.getAccessToken(); const url = new URL( `${APP_DISTRIBUTION_ENDPOINT}/${ENDPOINT_VERSION}/${operationName}` ); const response = yield makeRequest(url.toString(), { headers: { authorization: `Bearer ${accessToken}` } }); return response; }); } }; export { Operations }; //# sourceMappingURL=chunk-N4JVPYC6.mjs.map