UNPKG

@moxb/shards-meteor-process-manager-core

Version:

Shards: Meteor process manager core

32 lines (31 loc) 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.publicationBackgroundProcesses = void 0; var meteor_1 = require("@moxb/meteor"); var collections_1 = require("./collections"); var controller_1 = require("./controller"); /** * This publication carries all process status info from the server to the client. */ exports.publicationBackgroundProcesses = (0, meteor_1.registerMeteorPublication)({ name: 'background-process-list', collection: collections_1.ProcessCollection, auth: function (_a, userId) { var scopeId = _a.scopeId; return (0, controller_1.getProcessController)().verifyScopeAccess(userId, scopeId, 'list processes'); }, prePublish: function (args) { (0, controller_1.getProcessController)().defineProcesses(args.scopeId, { onlyIfMissing: true }); }, selector: function (args) { var scopeId = args.scopeId, search = args.search; var selector = { scopeId: scopeId, }; if (search) { selector.name = { $regex: search, $options: 'im' }; } return selector; }, options: function () { return ({ sort: { detailLevel: 1 } }); }, });