@sonisoft/now-sdk-ext-core 2.2.1 → 2.4.0

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.
Files changed (68) hide show
  1. package/dist/comm/http/RequestHandler.js +7 -11
  2. package/dist/comm/http/RequestHandler.js.map +1 -1
  3. package/dist/comm/http/TableAPIRequest.js +3 -10
  4. package/dist/comm/http/TableAPIRequest.js.map +1 -1
  5. package/dist/index.d.ts +18 -0
  6. package/dist/index.js +18 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/sn/BackgroundScriptExecutor.d.ts +34 -0
  9. package/dist/sn/BackgroundScriptExecutor.js +96 -0
  10. package/dist/sn/BackgroundScriptExecutor.js.map +1 -1
  11. package/dist/sn/application/ApplicationManager.d.ts +58 -1
  12. package/dist/sn/application/ApplicationManager.js +202 -11
  13. package/dist/sn/application/ApplicationManager.js.map +1 -1
  14. package/dist/sn/application/StoreApplicationModels.d.ts +99 -0
  15. package/dist/sn/application/StoreApplicationModels.js +2 -0
  16. package/dist/sn/application/StoreApplicationModels.js.map +1 -0
  17. package/dist/sn/attachment/AttachmentManager.d.ts +32 -0
  18. package/dist/sn/attachment/AttachmentManager.js +87 -0
  19. package/dist/sn/attachment/AttachmentManager.js.map +1 -0
  20. package/dist/sn/attachment/AttachmentModels.d.ts +28 -0
  21. package/dist/sn/attachment/AttachmentModels.js +2 -0
  22. package/dist/sn/attachment/AttachmentModels.js.map +1 -0
  23. package/dist/sn/batch/BatchModels.d.ts +90 -0
  24. package/dist/sn/batch/BatchModels.js +5 -0
  25. package/dist/sn/batch/BatchModels.js.map +1 -0
  26. package/dist/sn/batch/BatchOperations.d.ts +40 -0
  27. package/dist/sn/batch/BatchOperations.js +169 -0
  28. package/dist/sn/batch/BatchOperations.js.map +1 -0
  29. package/dist/sn/schema/SchemaDiscovery.d.ts +68 -0
  30. package/dist/sn/schema/SchemaDiscovery.js +346 -0
  31. package/dist/sn/schema/SchemaDiscovery.js.map +1 -0
  32. package/dist/sn/schema/SchemaModels.d.ts +277 -0
  33. package/dist/sn/schema/SchemaModels.js +5 -0
  34. package/dist/sn/schema/SchemaModels.js.map +1 -0
  35. package/dist/sn/scope/ScopeManager.d.ts +51 -0
  36. package/dist/sn/scope/ScopeManager.js +177 -0
  37. package/dist/sn/scope/ScopeManager.js.map +1 -0
  38. package/dist/sn/scope/ScopeModels.d.ts +66 -0
  39. package/dist/sn/scope/ScopeModels.js +5 -0
  40. package/dist/sn/scope/ScopeModels.js.map +1 -0
  41. package/dist/sn/scriptsync/ScriptSync.d.ts +38 -0
  42. package/dist/sn/scriptsync/ScriptSync.js +266 -0
  43. package/dist/sn/scriptsync/ScriptSync.js.map +1 -0
  44. package/dist/sn/scriptsync/ScriptSyncModels.d.ts +55 -0
  45. package/dist/sn/scriptsync/ScriptSyncModels.js +8 -0
  46. package/dist/sn/scriptsync/ScriptSyncModels.js.map +1 -0
  47. package/dist/sn/scriptsync/ScriptWatcher.d.ts +30 -0
  48. package/dist/sn/scriptsync/ScriptWatcher.js +74 -0
  49. package/dist/sn/scriptsync/ScriptWatcher.js.map +1 -0
  50. package/dist/sn/task/TaskModels.d.ts +85 -0
  51. package/dist/sn/task/TaskModels.js +5 -0
  52. package/dist/sn/task/TaskModels.js.map +1 -0
  53. package/dist/sn/task/TaskOperations.d.ts +63 -0
  54. package/dist/sn/task/TaskOperations.js +195 -0
  55. package/dist/sn/task/TaskOperations.js.map +1 -0
  56. package/dist/sn/updateset/UpdateSetManager.d.ts +78 -0
  57. package/dist/sn/updateset/UpdateSetManager.js +391 -0
  58. package/dist/sn/updateset/UpdateSetManager.js.map +1 -0
  59. package/dist/sn/updateset/UpdateSetModels.d.ts +177 -0
  60. package/dist/sn/updateset/UpdateSetModels.js +5 -0
  61. package/dist/sn/updateset/UpdateSetModels.js.map +1 -0
  62. package/dist/sn/workflow/WorkflowManager.d.ts +81 -0
  63. package/dist/sn/workflow/WorkflowManager.js +388 -0
  64. package/dist/sn/workflow/WorkflowManager.js.map +1 -0
  65. package/dist/sn/workflow/WorkflowModels.d.ts +242 -0
  66. package/dist/sn/workflow/WorkflowModels.js +5 -0
  67. package/dist/sn/workflow/WorkflowModels.js.map +1 -0
  68. package/package.json +5 -5
@@ -0,0 +1,346 @@
1
+ import { Logger } from "../../util/Logger.js";
2
+ import { ServiceNowRequest } from "../../comm/http/ServiceNowRequest.js";
3
+ import { TableAPIRequest } from "../../comm/http/TableAPIRequest.js";
4
+ /**
5
+ * SchemaDiscovery provides operations for discovering ServiceNow table schemas,
6
+ * explaining fields, and validating catalog configurations.
7
+ */
8
+ export class SchemaDiscovery {
9
+ static SYS_DB_OBJECT_TABLE = 'sys_db_object';
10
+ static SYS_DICTIONARY_TABLE = 'sys_dictionary';
11
+ static SYS_CHOICE_TABLE = 'sys_choice';
12
+ static ITEM_OPTION_NEW_TABLE = 'item_option_new';
13
+ static CATALOG_UI_POLICY_TABLE = 'catalog_ui_policy';
14
+ _logger = new Logger("SchemaDiscovery");
15
+ _req;
16
+ _tableAPI;
17
+ _instance;
18
+ constructor(instance) {
19
+ this._instance = instance;
20
+ this._req = new ServiceNowRequest(instance);
21
+ this._tableAPI = new TableAPIRequest(instance);
22
+ }
23
+ /**
24
+ * Discover the schema for a ServiceNow table.
25
+ * Queries sys_db_object for table info and sys_dictionary for field definitions.
26
+ * Optionally includes choice tables, relationships, UI policies, and business rules.
27
+ *
28
+ * @param tableName The name of the table to discover
29
+ * @param options Optional flags to include additional information
30
+ * @returns TableSchema with all discovered information
31
+ * @throws Error if tableName is empty or the table is not found
32
+ */
33
+ async discoverTableSchema(tableName, options = {}) {
34
+ if (!tableName || tableName.trim().length === 0) {
35
+ throw new Error('Table name is required');
36
+ }
37
+ this._logger.info(`Discovering schema for table: ${tableName}`);
38
+ // Query sys_db_object for the table record
39
+ const tableQuery = {
40
+ sysparm_query: `name=${tableName}`,
41
+ sysparm_limit: 1
42
+ };
43
+ const tableResp = await this._tableAPI.get(SchemaDiscovery.SYS_DB_OBJECT_TABLE, tableQuery);
44
+ if (!tableResp || tableResp.status !== 200 || !tableResp.bodyObject?.result || tableResp.bodyObject.result.length === 0) {
45
+ throw new Error(`Table '${tableName}' not found in sys_db_object`);
46
+ }
47
+ const tableRecord = tableResp.bodyObject.result[0];
48
+ // Query sys_dictionary for field definitions
49
+ const dictQuery = {
50
+ sysparm_query: `name=${tableName}^elementISNOTEMPTY`,
51
+ sysparm_limit: 500
52
+ };
53
+ const dictResp = await this._tableAPI.get(SchemaDiscovery.SYS_DICTIONARY_TABLE, dictQuery);
54
+ const dictRecords = (dictResp.status === 200 && dictResp.bodyObject?.result) ? dictResp.bodyObject.result : [];
55
+ // Build field schemas
56
+ const fields = dictRecords.map((record) => {
57
+ const internalType = typeof record.internal_type === 'object' && record.internal_type !== null
58
+ ? record.internal_type.value || ''
59
+ : (record.internal_type || '');
60
+ const referenceTable = typeof record.reference === 'object' && record.reference !== null
61
+ ? record.reference.value || undefined
62
+ : (record.reference || undefined);
63
+ return {
64
+ name: record.element,
65
+ label: record.column_label || record.element,
66
+ internalType: internalType,
67
+ maxLength: parseInt(record.max_length || '0', 10),
68
+ mandatory: record.mandatory === 'true',
69
+ readOnly: record.read_only === 'true',
70
+ referenceTable: referenceTable,
71
+ defaultValue: record.default_value || undefined
72
+ };
73
+ });
74
+ // Determine super class
75
+ let superClass;
76
+ if (tableRecord.super_class) {
77
+ superClass = typeof tableRecord.super_class === 'object' && tableRecord.super_class !== null
78
+ ? tableRecord.super_class.display_value || tableRecord.super_class.value
79
+ : tableRecord.super_class;
80
+ }
81
+ const schema = {
82
+ table: tableName,
83
+ label: tableRecord.label || tableName,
84
+ superClass,
85
+ fields
86
+ };
87
+ // Optionally include choice tables
88
+ if (options.includeChoiceTables) {
89
+ schema.choiceTables = await this._getChoicesForTable(tableName);
90
+ }
91
+ // Optionally include relationships
92
+ if (options.includeRelationships) {
93
+ schema.relationships = this._extractRelationships(fields);
94
+ }
95
+ // Optionally include UI policies
96
+ if (options.includeUIPolicies) {
97
+ schema.uiPolicies = await this._getUIPoliciesForTable(tableName);
98
+ }
99
+ // Optionally include business rules
100
+ if (options.includeBusinessRules) {
101
+ schema.businessRules = await this._getBusinessRulesForTable(tableName);
102
+ }
103
+ this._logger.info(`Discovered schema for ${tableName}: ${fields.length} fields`);
104
+ return schema;
105
+ }
106
+ /**
107
+ * Explain a specific field on a table.
108
+ * Queries sys_dictionary for the field definition and sys_choice for available choices.
109
+ *
110
+ * @param tableName The table containing the field
111
+ * @param fieldName The field name to explain
112
+ * @returns Detailed FieldExplanation
113
+ * @throws Error if tableName or fieldName is empty, or the field is not found
114
+ */
115
+ async explainField(tableName, fieldName) {
116
+ if (!tableName || tableName.trim().length === 0) {
117
+ throw new Error('Table name is required');
118
+ }
119
+ if (!fieldName || fieldName.trim().length === 0) {
120
+ throw new Error('Field name is required');
121
+ }
122
+ this._logger.info(`Explaining field: ${tableName}.${fieldName}`);
123
+ // Query sys_dictionary for the specific field
124
+ const dictQuery = {
125
+ sysparm_query: `name=${tableName}^element=${fieldName}`,
126
+ sysparm_limit: 1
127
+ };
128
+ const dictResp = await this._tableAPI.get(SchemaDiscovery.SYS_DICTIONARY_TABLE, dictQuery);
129
+ if (!dictResp || dictResp.status !== 200 || !dictResp.bodyObject?.result || dictResp.bodyObject.result.length === 0) {
130
+ throw new Error(`Field '${fieldName}' not found on table '${tableName}'`);
131
+ }
132
+ const record = dictResp.bodyObject.result[0];
133
+ const internalType = typeof record.internal_type === 'object' && record.internal_type !== null
134
+ ? record.internal_type.value || ''
135
+ : (record.internal_type || '');
136
+ const referenceTable = typeof record.reference === 'object' && record.reference !== null
137
+ ? record.reference.value || undefined
138
+ : (record.reference || undefined);
139
+ // Query sys_choice for available choices
140
+ const choiceQuery = {
141
+ sysparm_query: `name=${tableName}^element=${fieldName}`,
142
+ sysparm_limit: 500
143
+ };
144
+ const choiceResp = await this._tableAPI.get(SchemaDiscovery.SYS_CHOICE_TABLE, choiceQuery);
145
+ let choices;
146
+ if (choiceResp.status === 200 && choiceResp.bodyObject?.result && choiceResp.bodyObject.result.length > 0) {
147
+ choices = choiceResp.bodyObject.result.map((choice) => ({
148
+ label: choice.label,
149
+ value: choice.value
150
+ }));
151
+ }
152
+ this._logger.info(`Explained field: ${tableName}.${fieldName}`);
153
+ return {
154
+ field: fieldName,
155
+ table: tableName,
156
+ label: record.column_label || fieldName,
157
+ type: internalType,
158
+ maxLength: parseInt(record.max_length || '0', 10),
159
+ mandatory: record.mandatory === 'true',
160
+ readOnly: record.read_only === 'true',
161
+ comments: record.comments || undefined,
162
+ help: record.help || undefined,
163
+ referenceTable,
164
+ choices
165
+ };
166
+ }
167
+ /**
168
+ * Validate a catalog item configuration.
169
+ * Checks variables (item_option_new) and UI policies (catalog_ui_policy) for integrity issues.
170
+ *
171
+ * @param catalogItemSysId The sys_id of the catalog item to validate
172
+ * @returns Validation result with issues, warnings, and errors
173
+ * @throws Error if catalogItemSysId is empty
174
+ */
175
+ async validateCatalogConfiguration(catalogItemSysId) {
176
+ if (!catalogItemSysId || catalogItemSysId.trim().length === 0) {
177
+ throw new Error('Catalog item sys_id is required');
178
+ }
179
+ this._logger.info(`Validating catalog configuration for: ${catalogItemSysId}`);
180
+ const issues = [];
181
+ // Query variables (item_option_new)
182
+ const varQuery = {
183
+ sysparm_query: `cat_item=${catalogItemSysId}`,
184
+ sysparm_limit: 500
185
+ };
186
+ const varResp = await this._tableAPI.get(SchemaDiscovery.ITEM_OPTION_NEW_TABLE, varQuery);
187
+ const variables = (varResp.status === 200 && varResp.bodyObject?.result) ? varResp.bodyObject.result : [];
188
+ // Validate variables
189
+ const variableNames = new Set();
190
+ for (const variable of variables) {
191
+ // Check for missing name
192
+ if (!variable.name || variable.name.trim().length === 0) {
193
+ issues.push({
194
+ severity: 'error',
195
+ component: 'variable',
196
+ sys_id: variable.sys_id,
197
+ issue: 'Variable has no name',
198
+ fix: 'Set a unique variable name'
199
+ });
200
+ }
201
+ else {
202
+ // Check for duplicate names
203
+ if (variableNames.has(variable.name)) {
204
+ issues.push({
205
+ severity: 'error',
206
+ component: 'variable',
207
+ sys_id: variable.sys_id,
208
+ issue: `Duplicate variable name: ${variable.name}`,
209
+ fix: 'Rename the variable to be unique within the catalog item'
210
+ });
211
+ }
212
+ variableNames.add(variable.name);
213
+ }
214
+ // Check for missing question text
215
+ if (!variable.question_text || variable.question_text.trim().length === 0) {
216
+ issues.push({
217
+ severity: 'warning',
218
+ component: 'variable',
219
+ sys_id: variable.sys_id,
220
+ issue: `Variable '${variable.name || 'unnamed'}' has no question text`,
221
+ fix: 'Add a descriptive question text for the variable'
222
+ });
223
+ }
224
+ // Check for inactive mandatory variables
225
+ if (variable.mandatory === 'true' && variable.active === 'false') {
226
+ issues.push({
227
+ severity: 'warning',
228
+ component: 'variable',
229
+ sys_id: variable.sys_id,
230
+ issue: `Mandatory variable '${variable.name || 'unnamed'}' is inactive`,
231
+ fix: 'Either activate the variable or remove the mandatory flag'
232
+ });
233
+ }
234
+ }
235
+ // Query UI policies
236
+ const policyQuery = {
237
+ sysparm_query: `catalog_item=${catalogItemSysId}`,
238
+ sysparm_limit: 500
239
+ };
240
+ const policyResp = await this._tableAPI.get(SchemaDiscovery.CATALOG_UI_POLICY_TABLE, policyQuery);
241
+ const policies = (policyResp.status === 200 && policyResp.bodyObject?.result) ? policyResp.bodyObject.result : [];
242
+ // Validate UI policies
243
+ for (const policy of policies) {
244
+ if (!policy.short_description || policy.short_description.trim().length === 0) {
245
+ issues.push({
246
+ severity: 'warning',
247
+ component: 'ui_policy',
248
+ sys_id: policy.sys_id,
249
+ issue: 'UI policy has no short description',
250
+ fix: 'Add a descriptive short description to the UI policy'
251
+ });
252
+ }
253
+ }
254
+ const errorCount = issues.filter(i => i.severity === 'error').length;
255
+ const warningCount = issues.filter(i => i.severity === 'warning').length;
256
+ this._logger.info(`Validation complete: ${errorCount} errors, ${warningCount} warnings`);
257
+ return {
258
+ valid: errorCount === 0,
259
+ issues,
260
+ warnings: warningCount,
261
+ errors: errorCount
262
+ };
263
+ }
264
+ /**
265
+ * Get choice values for all fields on a table.
266
+ * @private
267
+ */
268
+ async _getChoicesForTable(tableName) {
269
+ const choiceQuery = {
270
+ sysparm_query: `name=${tableName}`,
271
+ sysparm_limit: 1000
272
+ };
273
+ const choiceResp = await this._tableAPI.get(SchemaDiscovery.SYS_CHOICE_TABLE, choiceQuery);
274
+ if (choiceResp.status !== 200 || !choiceResp.bodyObject?.result) {
275
+ return [];
276
+ }
277
+ // Group choices by field
278
+ const fieldChoices = new Map();
279
+ for (const choice of choiceResp.bodyObject.result) {
280
+ if (!fieldChoices.has(choice.element)) {
281
+ fieldChoices.set(choice.element, []);
282
+ }
283
+ fieldChoices.get(choice.element).push({
284
+ label: choice.label,
285
+ value: choice.value
286
+ });
287
+ }
288
+ return Array.from(fieldChoices.entries()).map(([field, choices]) => ({
289
+ field,
290
+ choices
291
+ }));
292
+ }
293
+ /**
294
+ * Extract relationship information from field schemas (reference fields).
295
+ * @private
296
+ */
297
+ _extractRelationships(fields) {
298
+ return fields
299
+ .filter(f => f.referenceTable)
300
+ .map(f => ({
301
+ name: f.name,
302
+ type: 'reference',
303
+ relatedTable: f.referenceTable
304
+ }));
305
+ }
306
+ /**
307
+ * Get UI policies for a table.
308
+ * @private
309
+ */
310
+ async _getUIPoliciesForTable(tableName) {
311
+ const query = {
312
+ sysparm_query: `table=${tableName}`,
313
+ sysparm_limit: 500
314
+ };
315
+ const resp = await this._tableAPI.get('sys_ui_policy', query);
316
+ if (resp.status !== 200 || !resp.bodyObject?.result) {
317
+ return [];
318
+ }
319
+ return resp.bodyObject.result.map(policy => ({
320
+ sys_id: policy.sys_id,
321
+ short_description: policy.short_description || '',
322
+ active: policy.active === 'true'
323
+ }));
324
+ }
325
+ /**
326
+ * Get business rules for a table.
327
+ * @private
328
+ */
329
+ async _getBusinessRulesForTable(tableName) {
330
+ const query = {
331
+ sysparm_query: `collection=${tableName}`,
332
+ sysparm_limit: 500
333
+ };
334
+ const resp = await this._tableAPI.get('sys_script', query);
335
+ if (resp.status !== 200 || !resp.bodyObject?.result) {
336
+ return [];
337
+ }
338
+ return resp.bodyObject.result.map(rule => ({
339
+ sys_id: rule.sys_id,
340
+ name: rule.name || '',
341
+ when: rule.when || '',
342
+ active: rule.active === 'true'
343
+ }));
344
+ }
345
+ }
346
+ //# sourceMappingURL=SchemaDiscovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaDiscovery.js","sourceRoot":"","sources":["../../../src/sn/schema/SchemaDiscovery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAqBlE;;;GAGG;AACH,MAAM,OAAO,eAAe;IAChB,MAAM,CAAU,mBAAmB,GAAG,eAAe,CAAC;IACtD,MAAM,CAAU,oBAAoB,GAAG,gBAAgB,CAAC;IACxD,MAAM,CAAU,gBAAgB,GAAG,YAAY,CAAC;IAChD,MAAM,CAAU,qBAAqB,GAAG,iBAAiB,CAAC;IAC1D,MAAM,CAAU,uBAAuB,GAAG,mBAAmB,CAAC;IAE9D,OAAO,GAAW,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAChD,IAAI,CAAoB;IACxB,SAAS,CAAkB;IAC3B,SAAS,CAAqB;IAEtC,YAAmB,QAA4B;QAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,mBAAmB,CAAC,SAAiB,EAAE,UAA8B,EAAE;QAChF,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,EAAE,C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
1
+ /**
2
+ * Options for discovering a table schema.
3
+ */
4
+ export interface TableSchemaOptions {
5
+ /** Include internal type codes from sys_dictionary */
6
+ includeTypeCodes?: boolean;
7
+ /** Include choice tables (sys_choice) for fields with choices */
8
+ includeChoiceTables?: boolean;
9
+ /** Include relationship information */
10
+ includeRelationships?: boolean;
11
+ /** Include UI policies */
12
+ includeUIPolicies?: boolean;
13
+ /** Include business rules */
14
+ includeBusinessRules?: boolean;
15
+ }
16
+ /**
17
+ * Schema information for a single field.
18
+ */
19
+ export interface FieldSchema {
20
+ /** Internal field name */
21
+ name: string;
22
+ /** Display label */
23
+ label: string;
24
+ /** Internal type (e.g., "string", "integer", "reference") */
25
+ internalType: string;
26
+ /** Maximum length for the field */
27
+ maxLength: number;
28
+ /** Whether the field is mandatory */
29
+ mandatory: boolean;
30
+ /** Whether the field is read-only */
31
+ readOnly: boolean;
32
+ /** Reference table name (for reference fields) */
33
+ referenceTable?: string;
34
+ /** Default value for the field */
35
+ defaultValue?: string;
36
+ }
37
+ /**
38
+ * Schema for a ServiceNow table.
39
+ */
40
+ export interface TableSchema {
41
+ /** Table name */
42
+ table: string;
43
+ /** Display label of the table */
44
+ label: string;
45
+ /** Super class (parent table) if any */
46
+ superClass?: string;
47
+ /** Array of field schemas */
48
+ fields: FieldSchema[];
49
+ /** Choice tables data (if includeChoiceTables was true) */
50
+ choiceTables?: Array<{
51
+ field: string;
52
+ choices: Array<{
53
+ label: string;
54
+ value: string;
55
+ }>;
56
+ }>;
57
+ /** Relationship data (if includeRelationships was true) */
58
+ relationships?: Array<{
59
+ name: string;
60
+ type: string;
61
+ relatedTable: string;
62
+ }>;
63
+ /** UI policies (if includeUIPolicies was true) */
64
+ uiPolicies?: Array<{
65
+ sys_id: string;
66
+ short_description: string;
67
+ active: boolean;
68
+ }>;
69
+ /** Business rules (if includeBusinessRules was true) */
70
+ businessRules?: Array<{
71
+ sys_id: string;
72
+ name: string;
73
+ when: string;
74
+ active: boolean;
75
+ }>;
76
+ }
77
+ /**
78
+ * Detailed explanation of a field.
79
+ */
80
+ export interface FieldExplanation {
81
+ /** Internal field name */
82
+ field: string;
83
+ /** Table the field belongs to */
84
+ table: string;
85
+ /** Display label */
86
+ label: string;
87
+ /** Internal type */
88
+ type: string;
89
+ /** Maximum length */
90
+ maxLength: number;
91
+ /** Whether the field is mandatory */
92
+ mandatory: boolean;
93
+ /** Whether the field is read-only */
94
+ readOnly: boolean;
95
+ /** Comments/description of the field */
96
+ comments?: string;
97
+ /** Help text for the field */
98
+ help?: string;
99
+ /** Reference table (for reference fields) */
100
+ referenceTable?: string;
101
+ /** Available choices (for choice fields) */
102
+ choices?: Array<{
103
+ label: string;
104
+ value: string;
105
+ }>;
106
+ }
107
+ /**
108
+ * A single validation issue found during catalog configuration validation.
109
+ */
110
+ export interface ValidationIssue {
111
+ /** Severity of the issue */
112
+ severity: 'error' | 'warning';
113
+ /** Component type where the issue was found */
114
+ component: string;
115
+ /** sys_id of the component (if applicable) */
116
+ sys_id?: string;
117
+ /** Description of the issue */
118
+ issue: string;
119
+ /** Suggested fix */
120
+ fix?: string;
121
+ }
122
+ /**
123
+ * Result of validating a catalog configuration.
124
+ */
125
+ export interface CatalogValidationResult {
126
+ /** Whether the configuration is valid (no errors) */
127
+ valid: boolean;
128
+ /** Array of validation issues */
129
+ issues: ValidationIssue[];
130
+ /** Count of warnings */
131
+ warnings: number;
132
+ /** Count of errors */
133
+ errors: number;
134
+ }
135
+ /**
136
+ * Record from the sys_db_object table.
137
+ */
138
+ export interface SysDbObjectRecord {
139
+ /** System ID */
140
+ sys_id: string;
141
+ /** Table name */
142
+ name: string;
143
+ /** Display label */
144
+ label?: string;
145
+ /** Super class (parent table) reference */
146
+ super_class?: string | {
147
+ link: string;
148
+ value: string;
149
+ display_value?: string;
150
+ };
151
+ /** Additional fields */
152
+ [key: string]: unknown;
153
+ }
154
+ /**
155
+ * Response wrapper for sys_db_object query.
156
+ */
157
+ export interface SysDbObjectResponse {
158
+ result: SysDbObjectRecord[];
159
+ }
160
+ /**
161
+ * Record from the sys_dictionary table.
162
+ */
163
+ export interface SysDictionaryRecord {
164
+ /** System ID */
165
+ sys_id: string;
166
+ /** Table name */
167
+ name: string;
168
+ /** Field element name */
169
+ element: string;
170
+ /** Display label (column_label) */
171
+ column_label?: string;
172
+ /** Internal type */
173
+ internal_type?: string | {
174
+ link: string;
175
+ value: string;
176
+ display_value?: string;
177
+ };
178
+ /** Maximum length */
179
+ max_length?: string;
180
+ /** Whether the field is mandatory */
181
+ mandatory?: string;
182
+ /** Whether the field is read-only */
183
+ read_only?: string;
184
+ /** Reference table */
185
+ reference?: string | {
186
+ link: string;
187
+ value: string;
188
+ display_value?: string;
189
+ };
190
+ /** Default value */
191
+ default_value?: string;
192
+ /** Comments */
193
+ comments?: string;
194
+ /** Help text */
195
+ help?: string;
196
+ /** Additional fields */
197
+ [key: string]: unknown;
198
+ }
199
+ /**
200
+ * Response wrapper for sys_dictionary query.
201
+ */
202
+ export interface SysDictionaryResponse {
203
+ result: SysDictionaryRecord[];
204
+ }
205
+ /**
206
+ * Record from the sys_choice table.
207
+ */
208
+ export interface SysChoiceRecord {
209
+ /** System ID */
210
+ sys_id: string;
211
+ /** Table name */
212
+ name: string;
213
+ /** Field element name */
214
+ element: string;
215
+ /** Choice label */
216
+ label: string;
217
+ /** Choice value */
218
+ value: string;
219
+ /** Additional fields */
220
+ [key: string]: unknown;
221
+ }
222
+ /**
223
+ * Response wrapper for sys_choice query.
224
+ */
225
+ export interface SysChoiceResponse {
226
+ result: SysChoiceRecord[];
227
+ }
228
+ /**
229
+ * Record from the catalog item options (item_option_new) table.
230
+ */
231
+ export interface CatalogItemOptionRecord {
232
+ /** System ID */
233
+ sys_id: string;
234
+ /** Variable name */
235
+ name?: string;
236
+ /** Question text */
237
+ question_text?: string;
238
+ /** Variable type */
239
+ type?: string;
240
+ /** Whether the variable is mandatory */
241
+ mandatory?: string;
242
+ /** Catalog item reference */
243
+ cat_item?: string;
244
+ /** Order */
245
+ order?: string;
246
+ /** Active flag */
247
+ active?: string;
248
+ /** Additional fields */
249
+ [key: string]: unknown;
250
+ }
251
+ /**
252
+ * Response wrapper for catalog item option query.
253
+ */
254
+ export interface CatalogItemOptionResponse {
255
+ result: CatalogItemOptionRecord[];
256
+ }
257
+ /**
258
+ * Record from the catalog_ui_policy table.
259
+ */
260
+ export interface CatalogUIPolicyRecord {
261
+ /** System ID */
262
+ sys_id: string;
263
+ /** Short description */
264
+ short_description?: string;
265
+ /** Catalog item reference */
266
+ catalog_item?: string;
267
+ /** Active flag */
268
+ active?: string;
269
+ /** Additional fields */
270
+ [key: string]: unknown;
271
+ }
272
+ /**
273
+ * Response wrapper for catalog UI policy query.
274
+ */
275
+ export interface CatalogUIPolicyResponse {
276
+ result: CatalogUIPolicyRecord[];
277
+ }
@@ -0,0 +1,5 @@
1
+ // ============================================================
2
+ // Options Types
3
+ // ============================================================
4
+ export {};
5
+ //# sourceMappingURL=SchemaModels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaModels.js","sourceRoot":"","sources":["../../../src/sn/schema/SchemaModels.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gBAAgB;AAChB,+DAA+D"}