UNPKG

zephyr-agent

Version:
74 lines (73 loc) • 2.94 kB
"use strict"; var __webpack_require__ = {}; (()=>{ __webpack_require__.d = (exports1, getters, values)=>{ var define = (defs, kind)=>{ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, { enumerable: true, [kind]: defs[key] }); }; define(getters, "get"); define(values, "value"); }; })(); (()=>{ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop); })(); (()=>{ __webpack_require__.r = (exports1)=>{ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, { value: 'Module' }); Object.defineProperty(exports1, '__esModule', { value: true }); }; })(); var __webpack_exports__ = {}; __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, { getBuildId: ()=>getBuildId }); const index_js_namespaceObject = require("../errors/index.js"); const http_request_js_namespaceObject = require("../http/http-request.js"); const external_logging_index_js_namespaceObject = require("../logging/index.js"); const token_js_namespaceObject = require("../node-persist/token.js"); const external_get_application_configuration_js_namespaceObject = require("./get-application-configuration.js"); async function getBuildId(application_uid) { try { const { BUILD_ID_ENDPOINT, user_uuid, jwt, username } = await (0, external_get_application_configuration_js_namespaceObject.getApplicationConfiguration)({ application_uid }); const token = await (0, token_js_namespaceObject.getToken)(); const options = { headers: { can_write_jwt: jwt, Authorization: 'Bearer ' + token }, credentialToken: token }; const [ok, cause, data] = await (0, http_request_js_namespaceObject.makeRequest)(BUILD_ID_ENDPOINT, options); if (!ok || !data[user_uuid]) throw new index_js_namespaceObject.ZephyrError(index_js_namespaceObject.ZeErrors.ERR_GET_BUILD_ID, { application_uid, username, cause, data: { responseKeys: Object.keys(data ?? {}) } }); external_logging_index_js_namespaceObject.ze_log.app('Build ID retrieved...', data); return data[user_uuid]; } catch (error) { throw index_js_namespaceObject.ZephyrError.withContext(error, 'create-build-id'); } } exports.getBuildId = __webpack_exports__.getBuildId; for(var __rspack_i in __webpack_exports__)if (-1 === [ "getBuildId" ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i]; Object.defineProperty(exports, '__esModule', { value: true }); //# sourceMappingURL=get-build-id.js.map