sml-baseline 1.3.5 → 1.3.6

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.
@@ -0,0 +1,322 @@
1
+ export declare const dashboardSchema: {
2
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
3
+ readonly $id: "viewschema/dashboard";
4
+ readonly type: "object";
5
+ readonly properties: {
6
+ readonly columns: {
7
+ readonly type: "integer";
8
+ readonly default: 12;
9
+ readonly 'x-widget': "number";
10
+ readonly 'x-group': "Layout";
11
+ };
12
+ readonly gap: {
13
+ readonly type: "number";
14
+ readonly default: 16;
15
+ readonly 'x-widget': "number";
16
+ readonly 'x-group': "Layout";
17
+ };
18
+ readonly globalContexts: {
19
+ readonly type: "array";
20
+ readonly items: {
21
+ readonly $ref: "#/$defs/globalContext";
22
+ };
23
+ };
24
+ readonly components: {
25
+ readonly type: "array";
26
+ readonly items: {
27
+ readonly $ref: "#/$defs/component";
28
+ };
29
+ };
30
+ };
31
+ readonly required: readonly ["components"];
32
+ readonly $defs: {
33
+ readonly common: {
34
+ readonly type: "object";
35
+ readonly properties: {
36
+ readonly visibleIf: {
37
+ readonly type: "string";
38
+ readonly 'x-widget': "template";
39
+ readonly 'x-jsonata': true;
40
+ readonly 'x-group': "Comune";
41
+ };
42
+ readonly colSpan: {
43
+ readonly type: "integer";
44
+ readonly minimum: 1;
45
+ readonly maximum: 12;
46
+ readonly 'x-widget': "number";
47
+ readonly 'x-group': "Layout";
48
+ readonly 'x-render': "grid.span";
49
+ };
50
+ readonly flexGrow: {
51
+ readonly type: "integer";
52
+ readonly minimum: 0;
53
+ readonly 'x-widget': "number";
54
+ readonly 'x-group': "Layout";
55
+ readonly 'x-render': "sx.flexGrow";
56
+ };
57
+ readonly padding: {
58
+ readonly type: "string";
59
+ readonly 'x-widget': "cssLength";
60
+ readonly 'x-group': "Layout";
61
+ readonly 'x-render': "sx.p";
62
+ };
63
+ readonly background: {
64
+ readonly type: "string";
65
+ readonly 'x-widget': "color";
66
+ readonly 'x-group': "Layout";
67
+ readonly 'x-render': "sx.bgcolor";
68
+ };
69
+ readonly minHeight: {
70
+ readonly type: "string";
71
+ readonly 'x-widget': "cssLength";
72
+ readonly 'x-group': "Layout";
73
+ readonly 'x-render': "sx.minHeight";
74
+ };
75
+ readonly storeKey: {
76
+ readonly type: "string";
77
+ readonly 'x-widget': "text";
78
+ readonly 'x-group': "Layout";
79
+ };
80
+ };
81
+ };
82
+ readonly globalContext: {
83
+ readonly type: "object";
84
+ readonly properties: {
85
+ readonly id: {
86
+ readonly type: "string";
87
+ readonly 'x-widget': "text";
88
+ };
89
+ readonly contextId: {
90
+ readonly type: "string";
91
+ readonly 'x-widget': "text";
92
+ };
93
+ readonly autoLoad: {
94
+ readonly type: "boolean";
95
+ readonly 'x-widget': "boolean";
96
+ readonly default: true;
97
+ };
98
+ readonly queries: {
99
+ readonly type: "string";
100
+ readonly 'x-widget': "template";
101
+ readonly 'x-jsonata': true;
102
+ };
103
+ readonly dependsOn: {
104
+ readonly type: "string";
105
+ readonly 'x-widget': "text";
106
+ };
107
+ readonly refreshInterval: {
108
+ readonly type: "number";
109
+ readonly 'x-widget': "number";
110
+ readonly default: 0;
111
+ };
112
+ readonly mapTemplate: {
113
+ readonly type: "string";
114
+ readonly 'x-widget': "template";
115
+ readonly 'x-jsonata': true;
116
+ };
117
+ readonly errorCondition: {
118
+ readonly type: "string";
119
+ readonly 'x-widget': "template";
120
+ readonly 'x-jsonata': true;
121
+ };
122
+ };
123
+ readonly required: readonly ["contextId", "queries"];
124
+ };
125
+ readonly component: {
126
+ readonly type: "object";
127
+ readonly properties: {
128
+ readonly id: {
129
+ readonly type: "string";
130
+ };
131
+ readonly type: {
132
+ readonly type: "string";
133
+ };
134
+ readonly props: {
135
+ readonly type: "object";
136
+ };
137
+ readonly children: {
138
+ readonly type: "array";
139
+ readonly items: {
140
+ readonly $ref: "#/$defs/component";
141
+ };
142
+ };
143
+ };
144
+ readonly required: readonly ["id", "type"];
145
+ readonly allOf: readonly [{
146
+ readonly if: {
147
+ readonly properties: {
148
+ readonly type: {
149
+ readonly const: "text";
150
+ };
151
+ };
152
+ };
153
+ readonly then: {
154
+ readonly properties: {
155
+ readonly props: {
156
+ readonly $ref: "#/$defs/props_text";
157
+ };
158
+ };
159
+ };
160
+ }, {
161
+ readonly if: {
162
+ readonly properties: {
163
+ readonly type: {
164
+ readonly const: "chip";
165
+ };
166
+ };
167
+ };
168
+ readonly then: {
169
+ readonly properties: {
170
+ readonly props: {
171
+ readonly $ref: "#/$defs/props_chip";
172
+ };
173
+ };
174
+ };
175
+ }, {
176
+ readonly if: {
177
+ readonly properties: {
178
+ readonly type: {
179
+ readonly const: "flex";
180
+ };
181
+ };
182
+ };
183
+ readonly then: {
184
+ readonly properties: {
185
+ readonly props: {
186
+ readonly $ref: "#/$defs/props_flex";
187
+ };
188
+ };
189
+ };
190
+ }];
191
+ };
192
+ readonly props_text: {
193
+ readonly type: "object";
194
+ readonly allOf: readonly [{
195
+ readonly $ref: "#/$defs/common";
196
+ }];
197
+ readonly properties: {
198
+ readonly content: {
199
+ readonly type: "string";
200
+ readonly 'x-widget': "template";
201
+ readonly 'x-jsonata': true;
202
+ readonly 'x-group': "Text";
203
+ };
204
+ readonly textVariant: {
205
+ readonly type: "string";
206
+ readonly enum: readonly ["h1", "h2", "h3", "h4", "h5", "h6", "body1", "body2", "caption", "subtitle1", "subtitle2"];
207
+ readonly 'x-widget': "select";
208
+ readonly 'x-group': "Text";
209
+ };
210
+ readonly textAlign: {
211
+ readonly type: "string";
212
+ readonly enum: readonly ["left", "center", "right"];
213
+ readonly 'x-widget': "select";
214
+ readonly 'x-group': "Text";
215
+ };
216
+ readonly bold: {
217
+ readonly type: "boolean";
218
+ readonly 'x-widget': "boolean";
219
+ readonly 'x-group': "Text";
220
+ };
221
+ readonly italic: {
222
+ readonly type: "boolean";
223
+ readonly 'x-widget': "boolean";
224
+ readonly 'x-group': "Text";
225
+ };
226
+ };
227
+ readonly unevaluatedProperties: false;
228
+ readonly 'x-component': {
229
+ readonly label: "Text";
230
+ readonly icon: "Type";
231
+ readonly category: "content";
232
+ readonly isContainer: false;
233
+ };
234
+ };
235
+ readonly props_chip: {
236
+ readonly type: "object";
237
+ readonly allOf: readonly [{
238
+ readonly $ref: "#/$defs/common";
239
+ }];
240
+ readonly properties: {
241
+ readonly label: {
242
+ readonly type: "string";
243
+ readonly 'x-widget': "template";
244
+ readonly 'x-jsonata': true;
245
+ readonly 'x-group': "Chip";
246
+ };
247
+ readonly chipColor: {
248
+ readonly type: "string";
249
+ readonly enum: readonly ["default", "primary", "secondary", "error", "info", "success", "warning"];
250
+ readonly 'x-widget': "select";
251
+ readonly default: "primary";
252
+ readonly 'x-group': "Chip";
253
+ };
254
+ readonly chipVariant: {
255
+ readonly type: "string";
256
+ readonly enum: readonly ["filled", "outlined"];
257
+ readonly 'x-widget': "select";
258
+ readonly 'x-group': "Chip";
259
+ };
260
+ readonly chipSize: {
261
+ readonly type: "string";
262
+ readonly enum: readonly ["small", "medium"];
263
+ readonly 'x-widget': "select";
264
+ readonly 'x-group': "Chip";
265
+ };
266
+ };
267
+ readonly unevaluatedProperties: false;
268
+ readonly 'x-component': {
269
+ readonly label: "Chip";
270
+ readonly icon: "Tag";
271
+ readonly category: "content";
272
+ readonly isContainer: false;
273
+ };
274
+ };
275
+ readonly props_flex: {
276
+ readonly type: "object";
277
+ readonly allOf: readonly [{
278
+ readonly $ref: "#/$defs/common";
279
+ }];
280
+ readonly properties: {
281
+ readonly flexDirection: {
282
+ readonly type: "string";
283
+ readonly enum: readonly ["row", "column", "row-reverse", "column-reverse"];
284
+ readonly 'x-widget': "select";
285
+ readonly 'x-group': "Flex";
286
+ };
287
+ readonly flexWrap: {
288
+ readonly type: "string";
289
+ readonly enum: readonly ["nowrap", "wrap", "wrap-reverse"];
290
+ readonly 'x-widget': "select";
291
+ readonly 'x-group': "Flex";
292
+ };
293
+ readonly justifyContent: {
294
+ readonly type: "string";
295
+ readonly enum: readonly ["flex-start", "flex-end", "center", "space-between", "space-around", "space-evenly"];
296
+ readonly 'x-widget': "select";
297
+ readonly 'x-group': "Flex";
298
+ };
299
+ readonly alignItems: {
300
+ readonly type: "string";
301
+ readonly enum: readonly ["flex-start", "flex-end", "center", "stretch", "baseline"];
302
+ readonly 'x-widget': "select";
303
+ readonly 'x-group': "Flex";
304
+ };
305
+ readonly flexGap: {
306
+ readonly type: "string";
307
+ readonly 'x-widget': "cssLength";
308
+ readonly 'x-group': "Flex";
309
+ };
310
+ };
311
+ readonly unevaluatedProperties: false;
312
+ readonly 'x-component': {
313
+ readonly label: "Flex";
314
+ readonly icon: "Columns";
315
+ readonly category: "layout";
316
+ readonly isContainer: true;
317
+ };
318
+ };
319
+ };
320
+ };
321
+ export type ArtifactName = 'dashboard';
322
+ export declare const VIEW_SCHEMAS: Record<ArtifactName, object>;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VIEW_SCHEMAS = exports.dashboardSchema = void 0;
4
+ exports.dashboardSchema = {
5
+ $schema: 'https://json-schema.org/draft/2020-12/schema',
6
+ $id: 'viewschema/dashboard',
7
+ type: 'object',
8
+ properties: {
9
+ columns: { type: 'integer', default: 12, 'x-widget': 'number', 'x-group': 'Layout' },
10
+ gap: { type: 'number', default: 16, 'x-widget': 'number', 'x-group': 'Layout' },
11
+ globalContexts: { type: 'array', items: { $ref: '#/$defs/globalContext' } },
12
+ components: { type: 'array', items: { $ref: '#/$defs/component' } },
13
+ },
14
+ required: ['components'],
15
+ $defs: {
16
+ common: {
17
+ type: 'object',
18
+ properties: {
19
+ visibleIf: { type: 'string', 'x-widget': 'template', 'x-jsonata': true, 'x-group': 'Comune' },
20
+ colSpan: { type: 'integer', minimum: 1, maximum: 12, 'x-widget': 'number', 'x-group': 'Layout', 'x-render': 'grid.span' },
21
+ flexGrow: { type: 'integer', minimum: 0, 'x-widget': 'number', 'x-group': 'Layout', 'x-render': 'sx.flexGrow' },
22
+ padding: { type: 'string', 'x-widget': 'cssLength', 'x-group': 'Layout', 'x-render': 'sx.p' },
23
+ background: { type: 'string', 'x-widget': 'color', 'x-group': 'Layout', 'x-render': 'sx.bgcolor' },
24
+ minHeight: { type: 'string', 'x-widget': 'cssLength', 'x-group': 'Layout', 'x-render': 'sx.minHeight' },
25
+ storeKey: { type: 'string', 'x-widget': 'text', 'x-group': 'Layout' },
26
+ },
27
+ },
28
+ globalContext: {
29
+ type: 'object',
30
+ properties: {
31
+ id: { type: 'string', 'x-widget': 'text' },
32
+ contextId: { type: 'string', 'x-widget': 'text' },
33
+ autoLoad: { type: 'boolean', 'x-widget': 'boolean', default: true },
34
+ queries: { type: 'string', 'x-widget': 'template', 'x-jsonata': true },
35
+ dependsOn: { type: 'string', 'x-widget': 'text' },
36
+ refreshInterval: { type: 'number', 'x-widget': 'number', default: 0 },
37
+ mapTemplate: { type: 'string', 'x-widget': 'template', 'x-jsonata': true },
38
+ errorCondition: { type: 'string', 'x-widget': 'template', 'x-jsonata': true },
39
+ },
40
+ required: ['contextId', 'queries'],
41
+ },
42
+ component: {
43
+ type: 'object',
44
+ properties: {
45
+ id: { type: 'string' },
46
+ type: { type: 'string' },
47
+ props: { type: 'object' },
48
+ children: { type: 'array', items: { $ref: '#/$defs/component' } },
49
+ },
50
+ required: ['id', 'type'],
51
+ allOf: [
52
+ { if: { properties: { type: { const: 'text' } } }, then: { properties: { props: { $ref: '#/$defs/props_text' } } } },
53
+ { if: { properties: { type: { const: 'chip' } } }, then: { properties: { props: { $ref: '#/$defs/props_chip' } } } },
54
+ { if: { properties: { type: { const: 'flex' } } }, then: { properties: { props: { $ref: '#/$defs/props_flex' } } } },
55
+ ],
56
+ },
57
+ props_text: {
58
+ type: 'object',
59
+ allOf: [{ $ref: '#/$defs/common' }],
60
+ properties: {
61
+ content: { type: 'string', 'x-widget': 'template', 'x-jsonata': true, 'x-group': 'Text' },
62
+ textVariant: { type: 'string', enum: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'body1', 'body2', 'caption', 'subtitle1', 'subtitle2'], 'x-widget': 'select', 'x-group': 'Text' },
63
+ textAlign: { type: 'string', enum: ['left', 'center', 'right'], 'x-widget': 'select', 'x-group': 'Text' },
64
+ bold: { type: 'boolean', 'x-widget': 'boolean', 'x-group': 'Text' },
65
+ italic: { type: 'boolean', 'x-widget': 'boolean', 'x-group': 'Text' },
66
+ },
67
+ unevaluatedProperties: false,
68
+ 'x-component': { label: 'Text', icon: 'Type', category: 'content', isContainer: false },
69
+ },
70
+ props_chip: {
71
+ type: 'object',
72
+ allOf: [{ $ref: '#/$defs/common' }],
73
+ properties: {
74
+ label: { type: 'string', 'x-widget': 'template', 'x-jsonata': true, 'x-group': 'Chip' },
75
+ chipColor: { type: 'string', enum: ['default', 'primary', 'secondary', 'error', 'info', 'success', 'warning'], 'x-widget': 'select', default: 'primary', 'x-group': 'Chip' },
76
+ chipVariant: { type: 'string', enum: ['filled', 'outlined'], 'x-widget': 'select', 'x-group': 'Chip' },
77
+ chipSize: { type: 'string', enum: ['small', 'medium'], 'x-widget': 'select', 'x-group': 'Chip' },
78
+ },
79
+ unevaluatedProperties: false,
80
+ 'x-component': { label: 'Chip', icon: 'Tag', category: 'content', isContainer: false },
81
+ },
82
+ props_flex: {
83
+ type: 'object',
84
+ allOf: [{ $ref: '#/$defs/common' }],
85
+ properties: {
86
+ flexDirection: { type: 'string', enum: ['row', 'column', 'row-reverse', 'column-reverse'], 'x-widget': 'select', 'x-group': 'Flex' },
87
+ flexWrap: { type: 'string', enum: ['nowrap', 'wrap', 'wrap-reverse'], 'x-widget': 'select', 'x-group': 'Flex' },
88
+ justifyContent: { type: 'string', enum: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly'], 'x-widget': 'select', 'x-group': 'Flex' },
89
+ alignItems: { type: 'string', enum: ['flex-start', 'flex-end', 'center', 'stretch', 'baseline'], 'x-widget': 'select', 'x-group': 'Flex' },
90
+ flexGap: { type: 'string', 'x-widget': 'cssLength', 'x-group': 'Flex' },
91
+ },
92
+ unevaluatedProperties: false,
93
+ 'x-component': { label: 'Flex', icon: 'Columns', category: 'layout', isContainer: true },
94
+ },
95
+ },
96
+ };
97
+ exports.VIEW_SCHEMAS = { dashboard: exports.dashboardSchema };
98
+ //# sourceMappingURL=dashboard.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard.schema.js","sourceRoot":"","sources":["../../../src/viewschema/schemas/dashboard.schema.ts"],"names":[],"mappings":";;;AAUa,QAAA,eAAe,GAAG;IAC7B,OAAO,EAAE,8CAA8C;IACvD,GAAG,EAAE,sBAAsB;IAC3B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE;QACpF,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE;QAC/E,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE;QAC3E,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,EAAE;KACpE;IACD,QAAQ,EAAE,CAAC,YAAY,CAAC;IACxB,KAAK,EAAE;QACL,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE;gBAC7F,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAA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E,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE;gBAC/G,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE;gBACxK,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE;gBAC1I,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE;aACxE;YACD,qBAAqB,EAAE,KAAK;YAC5B,aAAa,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE;SACzF;KACF;CACO,CAAC;AAIE,QAAA,YAAY,GAAiC,EAAE,SAAS,EAAE,uBAAe,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ViewschemaService } from './viewschema.service';
2
+ export declare class ViewschemaController {
3
+ private readonly service;
4
+ constructor(service: ViewschemaService);
5
+ getSchema(artifact: string): object;
6
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ViewschemaController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const swagger_1 = require("@nestjs/swagger");
18
+ const viewschema_service_1 = require("./viewschema.service");
19
+ let ViewschemaController = class ViewschemaController {
20
+ constructor(service) {
21
+ this.service = service;
22
+ }
23
+ getSchema(artifact) {
24
+ const schema = this.service.getSchema(artifact);
25
+ if (!schema)
26
+ throw new common_1.NotFoundException(`Schema sconosciuto: ${artifact}`);
27
+ return schema;
28
+ }
29
+ };
30
+ exports.ViewschemaController = ViewschemaController;
31
+ __decorate([
32
+ (0, common_1.Get)(':artifact'),
33
+ (0, common_1.Version)('1'),
34
+ (0, swagger_1.ApiOperation)({ summary: 'Ritorna il JSON Schema (SSOT) di un artefatto view' }),
35
+ __param(0, (0, common_1.Param)('artifact')),
36
+ __metadata("design:type", Function),
37
+ __metadata("design:paramtypes", [String]),
38
+ __metadata("design:returntype", void 0)
39
+ ], ViewschemaController.prototype, "getSchema", null);
40
+ exports.ViewschemaController = ViewschemaController = __decorate([
41
+ (0, swagger_1.ApiTags)('viewschema'),
42
+ (0, common_1.Controller)('viewschema'),
43
+ __metadata("design:paramtypes", [viewschema_service_1.ViewschemaService])
44
+ ], ViewschemaController);
45
+ //# sourceMappingURL=viewschema.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewschema.controller.js","sourceRoot":"","sources":["../../src/viewschema/viewschema.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoF;AACpF,6CAAwD;AACxD,6DAAyD;AAKlD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC/B,YAA6B,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAK3D,SAAS,CAAoB,QAAgB;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAwB,CAAC,CAAC;QAChE,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,0BAAiB,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAC;QAC5E,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AAXY,oDAAoB;AAM/B;IAHC,IAAA,YAAG,EAAC,WAAW,CAAC;IAChB,IAAA,gBAAO,EAAC,GAAG,CAAC;IACZ,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,oDAAoD,EAAE,CAAC;IACrE,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;;;;qDAI3B;+BAVU,oBAAoB;IAFhC,IAAA,iBAAO,EAAC,YAAY,CAAC;IACrB,IAAA,mBAAU,EAAC,YAAY,CAAC;qCAEe,sCAAiB;GAD5C,oBAAoB,CAWhC"}
@@ -0,0 +1,2 @@
1
+ export declare class ViewschemaModule {
2
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ViewschemaModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const viewschema_controller_1 = require("./viewschema.controller");
12
+ const viewschema_service_1 = require("./viewschema.service");
13
+ let ViewschemaModule = class ViewschemaModule {
14
+ };
15
+ exports.ViewschemaModule = ViewschemaModule;
16
+ exports.ViewschemaModule = ViewschemaModule = __decorate([
17
+ (0, common_1.Module)({
18
+ controllers: [viewschema_controller_1.ViewschemaController],
19
+ providers: [viewschema_service_1.ViewschemaService],
20
+ exports: [viewschema_service_1.ViewschemaService],
21
+ })
22
+ ], ViewschemaModule);
23
+ //# sourceMappingURL=viewschema.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewschema.module.js","sourceRoot":"","sources":["../../src/viewschema/viewschema.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mEAA+D;AAC/D,6DAAyD;AAOlD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,4CAAgB;2BAAhB,gBAAgB;IAL5B,IAAA,eAAM,EAAC;QACN,WAAW,EAAE,CAAC,4CAAoB,CAAC;QACnC,SAAS,EAAE,CAAC,sCAAiB,CAAC;QAC9B,OAAO,EAAE,CAAC,sCAAiB,CAAC;KAC7B,CAAC;GACW,gBAAgB,CAAG"}
@@ -0,0 +1,13 @@
1
+ import { ArtifactName } from './schemas/dashboard.schema';
2
+ export interface ValidationError {
3
+ instancePath: string;
4
+ keyword: string;
5
+ message: string;
6
+ }
7
+ export declare class ViewschemaService {
8
+ private readonly ajv;
9
+ private readonly validators;
10
+ constructor();
11
+ getSchema(artifact: ArtifactName): object | null;
12
+ validate(artifact: ArtifactName, config: unknown): ValidationError[];
13
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ViewschemaService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const _2020_1 = __importDefault(require("ajv/dist/2020"));
18
+ const ajv_formats_1 = __importDefault(require("ajv-formats"));
19
+ const jsonata_1 = __importDefault(require("jsonata"));
20
+ const dashboard_schema_1 = require("./schemas/dashboard.schema");
21
+ let ViewschemaService = class ViewschemaService {
22
+ constructor() {
23
+ this.validators = new Map();
24
+ this.ajv = new _2020_1.default({ allErrors: true, strict: false });
25
+ (0, ajv_formats_1.default)(this.ajv);
26
+ this.ajv.addKeyword({
27
+ keyword: 'x-jsonata',
28
+ schemaType: 'boolean',
29
+ validate: function vjsonata(on, data) {
30
+ if (!on || typeof data !== 'string')
31
+ return true;
32
+ const m = data.trim().match(/^\[\[([\s\S]*)\]\]$/);
33
+ if (!m)
34
+ return true;
35
+ try {
36
+ (0, jsonata_1.default)(m[1].trim());
37
+ return true;
38
+ }
39
+ catch (e) {
40
+ vjsonata.errors = [
41
+ { keyword: 'x-jsonata', message: `JSONata non valida: ${e.message}`, params: {} },
42
+ ];
43
+ return false;
44
+ }
45
+ },
46
+ errors: true,
47
+ });
48
+ }
49
+ getSchema(artifact) {
50
+ return dashboard_schema_1.VIEW_SCHEMAS[artifact] ?? null;
51
+ }
52
+ validate(artifact, config) {
53
+ const schema = this.getSchema(artifact);
54
+ if (!schema) {
55
+ return [{ instancePath: '', keyword: 'artifact', message: `Schema sconosciuto: ${artifact}` }];
56
+ }
57
+ let v = this.validators.get(artifact);
58
+ if (!v) {
59
+ v = this.ajv.compile(schema);
60
+ this.validators.set(artifact, v);
61
+ }
62
+ const ok = v(config);
63
+ if (ok)
64
+ return [];
65
+ return (v.errors ?? []).map((e) => ({
66
+ instancePath: e.instancePath,
67
+ keyword: e.keyword,
68
+ message: e.message ?? 'invalid',
69
+ }));
70
+ }
71
+ };
72
+ exports.ViewschemaService = ViewschemaService;
73
+ exports.ViewschemaService = ViewschemaService = __decorate([
74
+ (0, common_1.Injectable)(),
75
+ __metadata("design:paramtypes", [])
76
+ ], ViewschemaService);
77
+ //# sourceMappingURL=viewschema.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewschema.service.js","sourceRoot":"","sources":["../../src/viewschema/viewschema.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,0DAAuE;AACvE,8DAAqC;AACrC,sDAA8B;AAC9B,iEAAwE;AASjE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAI5B;QAFiB,eAAU,GAAG,IAAI,GAAG,EAA4B,CAAC;QAKhE,IAAI,CAAC,GAAG,GAAG,IAAI,eAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3D,IAAA,qBAAU,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAGrB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;YAClB,OAAO,EAAE,WAAW;YACpB,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,SAAS,QAAQ,CAAC,EAAW,EAAE,IAAa;gBACpD,IAAI,CAAC,EAAE,IAAI,OAAO,IAAI,KAAK,QAAQ;oBAAE,OAAO,IAAI,CAAC;gBACjD,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;gBACnD,IAAI,CAAC,CAAC;oBAAE,OAAO,IAAI,CAAC;gBACpB,IAAI,CAAC;oBACH,IAAA,iBAAO,EAAC,CAAC,CAAC,CAAC,CAAC,C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