MCPcopy Index your code
hub / github.com/dataease/SQLBot / dispatch

Method dispatch

frontend/public/swagger-ui-bundle.js:41366–41409  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41364 _hasRun(s) {
41365 return this.getPluginRunCount(this.getCurrentPlugin()) > (s || 0)
41366 }
41367 dispatch() {
41368 const s = this,
41369 o = this.nextPlugin()
41370 if (!o) {
41371 const s = this.nextPromisedPatch()
41372 if (s) return s.then(() => this.dispatch()).catch(() => this.dispatch())
41373 const o = { spec: this.state, errors: this.errors }
41374 return (this.showDebug && (o.patches = this.allPatches), Promise.resolve(o))
41375 }
41376 if (
41377 ((s.pluginCount = s.pluginCount || new WeakMap()),
41378 s.pluginCount.set(o, (s.pluginCount.get(o) || 0) + 1),
41379 s.pluginCount[o] > 100)
41380 )
41381 return Promise.resolve({
41382 spec: s.state,
41383 errors: s.errors.concat(new Error("We've reached a hard limit of 100 plugin runs")),
41384 })
41385 if (o !== this.currentPlugin && this.promisedPatches.length) {
41386 const s = this.promisedPatches.map((s) => s.value)
41387 return Promise.all(s.map((s) => s.then(specmap_noop, specmap_noop))).then(() =>
41388 this.dispatch()
41389 )
41390 }
41391 return (function executePlugin() {
41392 s.currentPlugin = o
41393 const i = s.getCurrentMutations(),
41394 a = s.mutations.length - 1
41395 try {
41396 if (o.isGenerator) for (const a of o(i, s.getLib())) updatePatches(a)
41397 else {
41398 updatePatches(o(i, s.getLib()))
41399 }
41400 } catch (s) {
41401 ;(console.error(s), updatePatches([Object.assign(Object.create(s), { plugin: o })]))
41402 } finally {
41403 s.updatePluginHistory(o, { mutationIndex: a })
41404 }
41405 return s.dispatch()
41406 })()
41407 function updatePatches(i) {
41408 i && ((i = Wo.fullyNormalizeArray(i)), s.updatePatches(i, o))
41409 }
41410 }
41411 }
41412 const tu = { refs: Xl, allOf: Ql, parameters: Zl, properties: eu }

Callers

nothing calls this directly

Calls 15

nextPluginMethod · 0.95
nextPromisedPatchMethod · 0.95
resolveMethod · 0.80
concatMethod · 0.80
getCurrentMutationsMethod · 0.80
getLibMethod · 0.80
errorMethod · 0.80
updatePluginHistoryMethod · 0.80
oFunction · 0.70
getMethod · 0.65
createMethod · 0.65
dispatchMethod · 0.65

Tested by

no test coverage detected