@aifabrix/builder 2.6.3 → 2.7.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.
- package/bin/aifabrix.js +4 -0
- package/lib/cli.js +51 -2
- package/lib/commands/datasource.js +94 -0
- package/lib/datasource-deploy.js +182 -0
- package/lib/datasource-diff.js +73 -0
- package/lib/datasource-list.js +138 -0
- package/lib/datasource-validate.js +63 -0
- package/lib/diff.js +266 -0
- package/lib/schema/application-schema.json +829 -687
- package/lib/schema/external-datasource.schema.json +464 -0
- package/lib/schema/external-system.schema.json +262 -0
- package/lib/secrets.js +20 -1
- package/lib/utils/env-copy.js +24 -0
- package/lib/utils/env-endpoints.js +50 -11
- package/lib/utils/schema-loader.js +220 -0
- package/lib/utils/schema-resolver.js +174 -0
- package/lib/utils/secrets-helpers.js +65 -17
- package/lib/validate.js +299 -0
- package/package.json +1 -1
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema":"https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id":"https://aifabrix.ai/schemas/external-datasource.schema.json",
|
|
4
|
+
"title":"External Data Source",
|
|
5
|
+
"description":"Configuration for AI Fabrix ExternalDataSource entities. Includes metadata schema, ABAC access fields, transformation mappings, OpenAPI/MCP exposure, and sync behavior.",
|
|
6
|
+
"type":"object",
|
|
7
|
+
"required":[
|
|
8
|
+
"key",
|
|
9
|
+
"displayName",
|
|
10
|
+
"systemKey",
|
|
11
|
+
"entityKey",
|
|
12
|
+
"fieldMappings"
|
|
13
|
+
],
|
|
14
|
+
"properties":{
|
|
15
|
+
"key":{
|
|
16
|
+
"type":"string",
|
|
17
|
+
"pattern":"^[a-z0-9-]+$",
|
|
18
|
+
"minLength":3,
|
|
19
|
+
"description":"Unique key of data source (e.g. 'hubspot-deal')."
|
|
20
|
+
},
|
|
21
|
+
"displayName":{
|
|
22
|
+
"type":"string",
|
|
23
|
+
"minLength":1
|
|
24
|
+
},
|
|
25
|
+
"description":{
|
|
26
|
+
"type":"string"
|
|
27
|
+
},
|
|
28
|
+
"enabled":{
|
|
29
|
+
"type":"boolean",
|
|
30
|
+
"default":true
|
|
31
|
+
},
|
|
32
|
+
"systemKey":{
|
|
33
|
+
"type":"string",
|
|
34
|
+
"pattern":"^[a-z0-9-]+$",
|
|
35
|
+
"description":"Must match ExternalSystem.key"
|
|
36
|
+
},
|
|
37
|
+
"entityKey":{
|
|
38
|
+
"type":"string",
|
|
39
|
+
"pattern":"^[a-z0-9-]+$"
|
|
40
|
+
},
|
|
41
|
+
"version":{
|
|
42
|
+
"type":"string",
|
|
43
|
+
"pattern":"^[0-9]+\\.[0-9]+\\.[0-9]+$",
|
|
44
|
+
"default":"1.0.0"
|
|
45
|
+
},
|
|
46
|
+
"metadataSchema":{
|
|
47
|
+
"type":"object",
|
|
48
|
+
"description":"Subset of JSON Schema used to validate raw input metadata.",
|
|
49
|
+
"additionalProperties":true
|
|
50
|
+
},
|
|
51
|
+
"fieldMappings":{
|
|
52
|
+
"type":"object",
|
|
53
|
+
"description":"Transformation rules and ABAC accessFields. Replaces older flat mapping schema.",
|
|
54
|
+
"required":[
|
|
55
|
+
"accessFields",
|
|
56
|
+
"fields"
|
|
57
|
+
],
|
|
58
|
+
"properties":{
|
|
59
|
+
"accessFields":{
|
|
60
|
+
"type":"array",
|
|
61
|
+
"description":"Normalized fields used in ABAC engine (must exist in 'fields').",
|
|
62
|
+
"items":{
|
|
63
|
+
"type":"string",
|
|
64
|
+
"pattern":"^[a-zA-Z0-9_]+$"
|
|
65
|
+
},
|
|
66
|
+
"minItems":1,
|
|
67
|
+
"uniqueItems":true
|
|
68
|
+
},
|
|
69
|
+
"fields":{
|
|
70
|
+
"type":"object",
|
|
71
|
+
"description":"Key = normalized field name. Value = transformation expression + type.",
|
|
72
|
+
"additionalProperties":{
|
|
73
|
+
"type":"object",
|
|
74
|
+
"required":[
|
|
75
|
+
"expression",
|
|
76
|
+
"type"
|
|
77
|
+
],
|
|
78
|
+
"properties":{
|
|
79
|
+
"expression":{
|
|
80
|
+
"type":"string",
|
|
81
|
+
"description":"Pipe-based DSL expression: '{{raw.path}} | toLower | trim'.",
|
|
82
|
+
"pattern":"^\\s*\\{\\{[^}]+\\}\\}(\\s*\\|\\s*[a-zA-Z0-9_]+(\\([^)]*\\))?)*\\s*$"
|
|
83
|
+
},
|
|
84
|
+
"type":{
|
|
85
|
+
"type":"string",
|
|
86
|
+
"enum":[
|
|
87
|
+
"string",
|
|
88
|
+
"number",
|
|
89
|
+
"integer",
|
|
90
|
+
"boolean",
|
|
91
|
+
"array",
|
|
92
|
+
"object"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"description":{
|
|
96
|
+
"type":"string"
|
|
97
|
+
},
|
|
98
|
+
"required":{
|
|
99
|
+
"type":"boolean"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"exposed":{
|
|
107
|
+
"type":"object",
|
|
108
|
+
"description":"Defines which normalized fields are exposed through MCP/OpenAPI. Ensures ISO27001-safe output and predictable AI model behavior.",
|
|
109
|
+
"properties":{
|
|
110
|
+
"fields":{
|
|
111
|
+
"type":"array",
|
|
112
|
+
"description":"List of normalized fields (from fieldMappings.fields keys) that the MCP/OpenAPI layers will return.",
|
|
113
|
+
"items":{
|
|
114
|
+
"type":"string",
|
|
115
|
+
"pattern":"^[a-zA-Z0-9_]+$"
|
|
116
|
+
},
|
|
117
|
+
"minItems":1,
|
|
118
|
+
"uniqueItems":true
|
|
119
|
+
},
|
|
120
|
+
"omit":{
|
|
121
|
+
"type":"array",
|
|
122
|
+
"description":"Fields that exist in normalized metadata but must NEVER be exposed by MCP/OpenAPI (e.g., secrets, internal IDs). Overrides 'fields'.",
|
|
123
|
+
"items":{
|
|
124
|
+
"type":"string",
|
|
125
|
+
"pattern":"^[a-zA-Z0-9_]+$"
|
|
126
|
+
},
|
|
127
|
+
"uniqueItems":true
|
|
128
|
+
},
|
|
129
|
+
"groups":{
|
|
130
|
+
"type":"object",
|
|
131
|
+
"description":"Optional logical grouping for OpenAPI/MCP schema generation (e.g., 'default', 'analytics', 'light').",
|
|
132
|
+
"additionalProperties":{
|
|
133
|
+
"type":"array",
|
|
134
|
+
"items":{
|
|
135
|
+
"type":"string",
|
|
136
|
+
"pattern":"^[a-zA-Z0-9_]+$"
|
|
137
|
+
},
|
|
138
|
+
"minItems":1,
|
|
139
|
+
"uniqueItems":true
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"readonly":{
|
|
143
|
+
"type":"array",
|
|
144
|
+
"description":"Fields exposed via MCP/OpenAPI but cannot be modified via write operations.",
|
|
145
|
+
"items":{
|
|
146
|
+
"type":"string",
|
|
147
|
+
"pattern":"^[a-zA-Z0-9_]+$"
|
|
148
|
+
},
|
|
149
|
+
"uniqueItems":true
|
|
150
|
+
},
|
|
151
|
+
"description":{
|
|
152
|
+
"type":"string",
|
|
153
|
+
"description":"Human-readable description of the exposure model for this data source."
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"required":[
|
|
157
|
+
"fields"
|
|
158
|
+
],
|
|
159
|
+
"additionalProperties":false
|
|
160
|
+
},
|
|
161
|
+
"sync":{
|
|
162
|
+
"type":"object",
|
|
163
|
+
"description":"Record synchronization rules.",
|
|
164
|
+
"properties":{
|
|
165
|
+
"mode":{
|
|
166
|
+
"type":"string",
|
|
167
|
+
"enum":[
|
|
168
|
+
"pull",
|
|
169
|
+
"push",
|
|
170
|
+
"bidirectional"
|
|
171
|
+
],
|
|
172
|
+
"default":"pull"
|
|
173
|
+
},
|
|
174
|
+
"schedule":{
|
|
175
|
+
"type":"string"
|
|
176
|
+
},
|
|
177
|
+
"batchSize":{
|
|
178
|
+
"type":"integer",
|
|
179
|
+
"minimum":1,
|
|
180
|
+
"maximum":10000,
|
|
181
|
+
"default":500
|
|
182
|
+
},
|
|
183
|
+
"maxParallelRequests":{
|
|
184
|
+
"type":"integer",
|
|
185
|
+
"minimum":1,
|
|
186
|
+
"maximum":50,
|
|
187
|
+
"default":5
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"openapi":{
|
|
192
|
+
"type":"object",
|
|
193
|
+
"description":"OpenAPI-driven connector configuration.",
|
|
194
|
+
"properties":{
|
|
195
|
+
"enabled":{
|
|
196
|
+
"type":"boolean",
|
|
197
|
+
"default":false
|
|
198
|
+
},
|
|
199
|
+
"documentKey":{
|
|
200
|
+
"type":"string"
|
|
201
|
+
},
|
|
202
|
+
"baseUrl":{
|
|
203
|
+
"type":"string",
|
|
204
|
+
"pattern":"^(http|https)://"
|
|
205
|
+
},
|
|
206
|
+
"resourcePath":{
|
|
207
|
+
"type":"string"
|
|
208
|
+
},
|
|
209
|
+
"operations":{
|
|
210
|
+
"type":"object",
|
|
211
|
+
"properties":{
|
|
212
|
+
"list":{
|
|
213
|
+
"type":"object",
|
|
214
|
+
"required":[
|
|
215
|
+
"operationId"
|
|
216
|
+
],
|
|
217
|
+
"properties":{
|
|
218
|
+
"operationId":{
|
|
219
|
+
"type":"string"
|
|
220
|
+
},
|
|
221
|
+
"method":{
|
|
222
|
+
"type":"string",
|
|
223
|
+
"enum":[
|
|
224
|
+
"GET",
|
|
225
|
+
"POST"
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"path":{
|
|
229
|
+
"type":"string"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"get":{
|
|
234
|
+
"type":"object",
|
|
235
|
+
"required":[
|
|
236
|
+
"operationId"
|
|
237
|
+
],
|
|
238
|
+
"properties":{
|
|
239
|
+
"operationId":{
|
|
240
|
+
"type":"string"
|
|
241
|
+
},
|
|
242
|
+
"method":{
|
|
243
|
+
"type":"string",
|
|
244
|
+
"enum":[
|
|
245
|
+
"GET"
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
"path":{
|
|
249
|
+
"type":"string"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"create":{
|
|
254
|
+
"type":"object",
|
|
255
|
+
"properties":{
|
|
256
|
+
"operationId":{
|
|
257
|
+
"type":"string"
|
|
258
|
+
},
|
|
259
|
+
"method":{
|
|
260
|
+
"type":"string",
|
|
261
|
+
"enum":[
|
|
262
|
+
"POST",
|
|
263
|
+
"PUT"
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
"path":{
|
|
267
|
+
"type":"string"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"update":{
|
|
272
|
+
"type":"object",
|
|
273
|
+
"properties":{
|
|
274
|
+
"operationId":{
|
|
275
|
+
"type":"string"
|
|
276
|
+
},
|
|
277
|
+
"method":{
|
|
278
|
+
"type":"string",
|
|
279
|
+
"enum":[
|
|
280
|
+
"PATCH",
|
|
281
|
+
"PUT",
|
|
282
|
+
"POST"
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
"path":{
|
|
286
|
+
"type":"string"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"delete":{
|
|
291
|
+
"type":"object",
|
|
292
|
+
"properties":{
|
|
293
|
+
"operationId":{
|
|
294
|
+
"type":"string"
|
|
295
|
+
},
|
|
296
|
+
"method":{
|
|
297
|
+
"type":"string",
|
|
298
|
+
"enum":[
|
|
299
|
+
"DELETE"
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
"path":{
|
|
303
|
+
"type":"string"
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"autoRbac":{
|
|
310
|
+
"type":"boolean",
|
|
311
|
+
"default":false,
|
|
312
|
+
"description":"Generates <system>.<entity>.<action> RBAC permissions."
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"mcp":{
|
|
317
|
+
"type":"object",
|
|
318
|
+
"description":"Model Context Protocol exposure.",
|
|
319
|
+
"properties":{
|
|
320
|
+
"enabled":{
|
|
321
|
+
"type":"boolean",
|
|
322
|
+
"default":false
|
|
323
|
+
},
|
|
324
|
+
"toolName":{
|
|
325
|
+
"type":"string",
|
|
326
|
+
"pattern":"^[a-z0-9-]+$"
|
|
327
|
+
},
|
|
328
|
+
"resourceName":{
|
|
329
|
+
"type":"string",
|
|
330
|
+
"pattern":"^[a-z0-9-:]+$"
|
|
331
|
+
},
|
|
332
|
+
"operations":{
|
|
333
|
+
"type":"array",
|
|
334
|
+
"items":{
|
|
335
|
+
"type":"object",
|
|
336
|
+
"required":[
|
|
337
|
+
"name",
|
|
338
|
+
"permission"
|
|
339
|
+
],
|
|
340
|
+
"properties":{
|
|
341
|
+
"name":{
|
|
342
|
+
"type":"string",
|
|
343
|
+
"pattern":"^[a-z0-9-]+$"
|
|
344
|
+
},
|
|
345
|
+
"permission":{
|
|
346
|
+
"type":"string",
|
|
347
|
+
"description":"Must match securityModel.permissions",
|
|
348
|
+
"pattern":"^[a-z0-9-:]+$"
|
|
349
|
+
},
|
|
350
|
+
"description":{
|
|
351
|
+
"type":"string"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
"validation":{
|
|
359
|
+
"type":"object",
|
|
360
|
+
"description":"Advanced validation rules applied before saving normalized metadata.",
|
|
361
|
+
"properties":{
|
|
362
|
+
"repeatingValues":{
|
|
363
|
+
"type":"array",
|
|
364
|
+
"items":{
|
|
365
|
+
"type":"object",
|
|
366
|
+
"required":[
|
|
367
|
+
"field",
|
|
368
|
+
"scope",
|
|
369
|
+
"strategy"
|
|
370
|
+
],
|
|
371
|
+
"properties":{
|
|
372
|
+
"field":{
|
|
373
|
+
"type":"string",
|
|
374
|
+
"pattern":"^[a-zA-Z0-9_]+$"
|
|
375
|
+
},
|
|
376
|
+
"scope":{
|
|
377
|
+
"type":"array",
|
|
378
|
+
"items":{
|
|
379
|
+
"type":"string"
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"strategy":{
|
|
383
|
+
"type":"string",
|
|
384
|
+
"enum":[
|
|
385
|
+
"reject",
|
|
386
|
+
"latest-wins",
|
|
387
|
+
"first-wins",
|
|
388
|
+
"merge"
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
"mergeFields":{
|
|
392
|
+
"type":"array",
|
|
393
|
+
"items":{
|
|
394
|
+
"type":"string"
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"portalInput":{
|
|
403
|
+
"type":"array",
|
|
404
|
+
"description":"Optional UI metadata definition for the AI Fabrix portal.",
|
|
405
|
+
"items":{
|
|
406
|
+
"type":"object",
|
|
407
|
+
"required":[
|
|
408
|
+
"name",
|
|
409
|
+
"field",
|
|
410
|
+
"label"
|
|
411
|
+
],
|
|
412
|
+
"properties":{
|
|
413
|
+
"name":{
|
|
414
|
+
"type":"string"
|
|
415
|
+
},
|
|
416
|
+
"field":{
|
|
417
|
+
"type":"string",
|
|
418
|
+
"enum":[
|
|
419
|
+
"text",
|
|
420
|
+
"textarea",
|
|
421
|
+
"select",
|
|
422
|
+
"json",
|
|
423
|
+
"boolean",
|
|
424
|
+
"number"
|
|
425
|
+
]
|
|
426
|
+
},
|
|
427
|
+
"label":{
|
|
428
|
+
"type":"string"
|
|
429
|
+
},
|
|
430
|
+
"placeholder":{
|
|
431
|
+
"type":"string"
|
|
432
|
+
},
|
|
433
|
+
"options":{
|
|
434
|
+
"type":"array",
|
|
435
|
+
"items":{
|
|
436
|
+
"type":"string"
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"masked":{
|
|
440
|
+
"type":"boolean"
|
|
441
|
+
},
|
|
442
|
+
"validation":{
|
|
443
|
+
"type":"object",
|
|
444
|
+
"properties":{
|
|
445
|
+
"minLength":{
|
|
446
|
+
"type":"integer"
|
|
447
|
+
},
|
|
448
|
+
"maxLength":{
|
|
449
|
+
"type":"integer"
|
|
450
|
+
},
|
|
451
|
+
"pattern":{
|
|
452
|
+
"type":"string"
|
|
453
|
+
},
|
|
454
|
+
"required":{
|
|
455
|
+
"type":"boolean"
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
"additionalProperties":false
|
|
464
|
+
}
|