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