"use strict";
exports.id = 833;
exports.ids = [833];
exports.modules = {

/***/ 4276:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "_": () => (/* binding */ getCollection),
/* harmony export */   "z": () => (/* binding */ getDb)
/* harmony export */ });
/* harmony import */ var lokijs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9460);
/* harmony import */ var lokijs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lokijs__WEBPACK_IMPORTED_MODULE_0__);

const LokiMemoryAdapter = (lokijs__WEBPACK_IMPORTED_MODULE_0___default().LokiMemoryAdapter);
const getDb = ()=>{
    if (!globalThis.memoryCache["db"]) {
        const db = new (lokijs__WEBPACK_IMPORTED_MODULE_0___default())("docmq", {
            adapter: new LokiMemoryAdapter({
                asyncResponses: true
            })
        });
        db.addCollection("tds-jobs", {
            unique: [
                "id"
            ],
            asyncListeners: true,
            clone: true
        });
        db.addCollection("tds-runs", {
            asyncListeners: true,
            clone: true
        });
        globalThis.memoryCache["db"] = db;
    }
    return globalThis.memoryCache["db"];
};
const getCollection = (name)=>{
    const db = getDb();
    return db.getCollection(name);
};


/***/ }),

/***/ 8085:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "D0": () => (/* binding */ bqToMango),
/* harmony export */   "LA": () => (/* binding */ jobFacets),
/* harmony export */   "nK": () => (/* binding */ runFacets)
/* harmony export */ });
// locally define boolean query structure
const jobFacets = {
    name: {
        __default: true,
        mango: (v)=>({
                name: {
                    $eq: v
                }
            })
    }
};
const runFacets = {
    jobId: {
        mango: (v)=>({
                "metadata.id": v
            })
    }
};
/** Convert a boolean query expression to mango syntax */ const bqToMango = (q, facets)=>{
    var ref;
    const defaultName = (ref = Object.keys(facets).map((k)=>facets[k].__default ? k : false).filter((t)=>t)) === null || ref === void 0 ? void 0 : ref[0];
    const defaultFacet = defaultName ? facets[defaultName] : null;
    const mango = {
        $or: q.map((or)=>{
            return {
                $and: or.map((and)=>{
                    const [f, ...rest] = and.split(":");
                    const facet = facets[f];
                    if (facet) {
                        return facet.mango(rest.join(":"));
                    } else if (defaultFacet) {
                        return defaultFacet.mango([
                            f,
                            ...rest
                        ].join(":"));
                    }
                    return null;
                })
            };
        })
    };
    return mango;
};


/***/ })

};
;