Line data Source code
1 : import { isCloud } from '@/platform/distribution/types'
2 : import { reportError } from '@comfyorg/telemetry/reportError'
3 : import { createInputSpecInterpreter } from '@comfyorg/object-info-parser/inputSpecInterpreter'
4 : import type { InputSpecDiagnosticSink } from '@comfyorg/object-info-parser/inputSpecInterpreter'
5 :
6 2356 : const MAX_SPEC_DRIFT_REPORTS = 10
7 2356 : const reportedSpecDrift = new Set<string>()
8 :
9 2356 : const warnSpecDrift: InputSpecDiagnosticSink = (spec, error, optionIndex) => {
10 0 : const location = JSON.stringify([spec.name, spec.type, optionIndex])
11 0 : if (
12 : reportedSpecDrift.has(location) ||
13 : reportedSpecDrift.size >= MAX_SPEC_DRIFT_REPORTS
14 : )
15 0 : return
16 :
17 0 : reportedSpecDrift.add(location)
18 :
19 0 : reportError(new Error('Unable to parse dynamic node input specification'), {
20 : surface: 'graph',
21 : errorType: 'error_parsing_node_input_spec',
22 : tags: {
23 : failure_kind: 'degraded',
24 : feature_area: 'node_definition',
25 : operation: 'parse_input_spec',
26 : outcome: 'recovered'
27 : },
28 : context: {
29 : controlType: spec.type,
30 : optionIndex,
31 : issueCount: error.issues.length
32 : },
33 : level: 'warning'
34 : })
35 : }
36 :
37 2356 : export const validatedInputSpecInterpreter =
38 : createInputSpecInterpreter(warnSpecDrift)
39 :
40 2356 : export const inputSpecInterpreter = createInputSpecInterpreter(warnSpecDrift, {
41 : skipValidation: () => isCloud
42 : })
43 :
44 2356 : export const {
45 : inputSpecTree,
46 : ownSlotTypes,
47 : dynamicComboOptionKeys,
48 : dynamicComboOptionTypes,
49 : flattenInputSpecs,
50 : collectSearchableOutputTypes
51 : } = validatedInputSpecInterpreter
|