snow-flow-test 10.0.1-test.142 → 10.0.1-test.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -61,6 +61,7 @@ async function lookupDefinitionParams(client: any, defSysId: string): Promise<an
|
|
|
61
61
|
params: {
|
|
62
62
|
sysparm_query: 'model=' + defSysId + '^ORaction_type=' + defSysId,
|
|
63
63
|
sysparm_fields: 'sys_id,name,element,label,internal_type,type,type_label,order,mandatory,readonly,maxsize,data_structure,reference,reference_display,ref_qual,choice_option,column_name,default_value,use_dependent,dependent_on,internal_link,attributes,sys_class_name',
|
|
64
|
+
sysparm_display_value: 'false',
|
|
64
65
|
sysparm_limit: 50
|
|
65
66
|
}
|
|
66
67
|
});
|
|
@@ -71,57 +72,68 @@ async function lookupDefinitionParams(client: any, defSysId: string): Promise<an
|
|
|
71
72
|
return [];
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
function str(v: any): string {
|
|
76
|
+
if (!v) return '';
|
|
77
|
+
if (typeof v === 'string') return v;
|
|
78
|
+
if (typeof v === 'object' && v.value !== undefined) return String(v.value);
|
|
79
|
+
return String(v);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function buildGraphQLInput(p: any, defaultValue?: any, forTrigger?: boolean): any {
|
|
83
|
+
const name = str(p.name) || str(p.element) || '';
|
|
84
|
+
const type = str(p.internal_type) || str(p.type) || 'string';
|
|
77
85
|
const isMandatory = p.mandatory === 'true' || p.mandatory === true;
|
|
78
|
-
const order = parseInt(p.order) || 100;
|
|
79
|
-
const defVal = defaultValue !== undefined ? defaultValue : (p.default_value || '');
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
const order = parseInt(str(p.order)) || 100;
|
|
87
|
+
const defVal = defaultValue !== undefined ? defaultValue : (str(p.default_value) || '');
|
|
88
|
+
const valueObj = type === 'conditions'
|
|
89
|
+
? { schemaless: false, schemalessValue: '', value: '^EQ' }
|
|
90
|
+
: defVal
|
|
91
|
+
? { schemaless: false, schemalessValue: '', value: String(defVal) }
|
|
92
|
+
: { value: '' };
|
|
93
|
+
const parameter: any = {
|
|
94
|
+
id: str(p.sys_id) || '',
|
|
95
|
+
label: str(p.label) || name,
|
|
82
96
|
name,
|
|
83
|
-
label: p.label || name,
|
|
84
|
-
internalType: type,
|
|
85
|
-
mandatory: isMandatory,
|
|
86
|
-
order,
|
|
87
|
-
valueSysId: '',
|
|
88
|
-
field_name: name,
|
|
89
97
|
type,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
children: []
|
|
124
|
-
}
|
|
98
|
+
type_label: str(p.type_label) || '',
|
|
99
|
+
hint: '',
|
|
100
|
+
order,
|
|
101
|
+
extended: false,
|
|
102
|
+
mandatory: isMandatory,
|
|
103
|
+
readonly: p.readonly === 'true' || p.readonly === true,
|
|
104
|
+
maxsize: parseInt(str(p.maxsize)) || 80,
|
|
105
|
+
data_structure: str(p.data_structure) || '',
|
|
106
|
+
reference: str(p.reference) || '',
|
|
107
|
+
reference_display: str(p.reference_display) || '',
|
|
108
|
+
ref_qual: str(p.ref_qual) || '',
|
|
109
|
+
choiceOption: str(p.choice_option) || '',
|
|
110
|
+
table: '',
|
|
111
|
+
columnName: str(p.column_name) || '',
|
|
112
|
+
defaultValue: str(p.default_value) || '',
|
|
113
|
+
use_dependent: p.use_dependent === 'true' || p.use_dependent === true,
|
|
114
|
+
dependent_on: str(p.dependent_on) || '',
|
|
115
|
+
show_ref_finder: false,
|
|
116
|
+
local: false,
|
|
117
|
+
attributes: str(p.attributes) || '',
|
|
118
|
+
sys_class_name: str(p.sys_class_name) || '',
|
|
119
|
+
children: []
|
|
120
|
+
};
|
|
121
|
+
if (!forTrigger) {
|
|
122
|
+
parameter.dynamic = null;
|
|
123
|
+
} else {
|
|
124
|
+
parameter.internal_link = p.internal_link || '';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (forTrigger) {
|
|
128
|
+
return {
|
|
129
|
+
name, label: str(p.label) || name, internalType: type, mandatory: isMandatory,
|
|
130
|
+
order, valueSysId: '', field_name: name, type,
|
|
131
|
+
children: [], displayValue: { value: '' }, value: valueObj, parameter
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
id: str(p.sys_id) || '', name,
|
|
136
|
+
children: [], displayValue: { value: '' }, value: valueObj, parameter
|
|
125
137
|
};
|
|
126
138
|
}
|
|
127
139
|
|
|
@@ -176,12 +188,12 @@ async function addTriggerViaGraphQL(
|
|
|
176
188
|
const params = await lookupDefinitionParams(client, trigDefId);
|
|
177
189
|
steps.params_found = params.length;
|
|
178
190
|
|
|
179
|
-
const gqlInputs = params.map((p: any) => buildGraphQLInput(p));
|
|
191
|
+
const gqlInputs = params.map((p: any) => buildGraphQLInput(p, undefined, true));
|
|
180
192
|
|
|
181
193
|
if (gqlInputs.length === 0 && config.triggerType === 'Record') {
|
|
182
194
|
gqlInputs.push(
|
|
183
|
-
buildGraphQLInput({ name: 'table', label: 'Table', internal_type: 'table_name', mandatory: 'true', order: '1' }),
|
|
184
|
-
buildGraphQLInput({ name: 'condition', label: 'Condition', internal_type: 'conditions', mandatory: 'false', order: '100', use_dependent: 'true', dependent_on: 'table' })
|
|
195
|
+
buildGraphQLInput({ name: 'table', label: 'Table', internal_type: 'table_name', mandatory: 'true', order: '1' }, undefined, true),
|
|
196
|
+
buildGraphQLInput({ name: 'condition', label: 'Condition', internal_type: 'conditions', mandatory: 'false', order: '100', use_dependent: 'true', dependent_on: 'table' }, undefined, true)
|
|
185
197
|
);
|
|
186
198
|
}
|
|
187
199
|
|