@digipair/skill-web-editor 0.113.1 → 0.114.1
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/README.md +7 -0
- package/{blockly-to-json.cjs.js → dist/blockly-to-json.cjs.js} +4 -6
- package/{blockly-to-json.esm.js → dist/blockly-to-json.esm.js} +4 -6
- package/{index.cjs2.js → dist/index.cjs.js} +155 -224
- package/{index.esm2.js → dist/index.esm.js} +156 -224
- package/{pins-to-blockly.cjs.js → dist/pins-to-blockly.cjs.js} +87 -95
- package/{pins-to-blockly.esm.js → dist/pins-to-blockly.esm.js} +87 -95
- package/{libs/skill-web-editor → dist}/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -0
- package/{libs/skill-web-editor → dist}/src/lib/blocks/json.d.ts +1 -0
- package/dist/src/lib/blocks/json.d.ts.map +1 -0
- package/{libs/skill-web-editor → dist}/src/lib/editor.element.d.ts +1 -0
- package/dist/src/lib/editor.element.d.ts.map +1 -0
- package/dist/src/lib/generator/blockly-to-json.d.ts +2 -0
- package/dist/src/lib/generator/blockly-to-json.d.ts.map +1 -0
- package/{libs/skill-web-editor → dist}/src/lib/generator/json-to-blockly.d.ts +1 -0
- package/dist/src/lib/generator/json-to-blockly.d.ts.map +1 -0
- package/{libs/skill-web-editor → dist}/src/lib/generator/pins-to-blockly.d.ts +1 -0
- package/dist/src/lib/generator/pins-to-blockly.d.ts.map +1 -0
- package/{libs/skill-web-editor → dist}/src/lib/schemas/web.fr.schema.d.ts +1 -0
- package/dist/src/lib/schemas/web.fr.schema.d.ts.map +1 -0
- package/{libs/skill-web-editor → dist}/src/lib/schemas/web.schema.d.ts +1 -0
- package/dist/src/lib/schemas/web.schema.d.ts.map +1 -0
- package/dist/src/lib/skill-web-editor.d.ts +2 -0
- package/dist/src/lib/skill-web-editor.d.ts.map +1 -0
- package/package.json +30 -5
- package/index.cjs.js +0 -12
- package/index.d.ts +0 -1
- package/index.esm.js +0 -1
- package/libs/skill-web-editor/src/lib/generator/blockly-to-json.d.ts +0 -1
- package/libs/skill-web-editor/src/lib/skill-web-editor.d.ts +0 -1
- /package/{index.cjs.d.ts → dist/index.d.ts} +0 -0
- /package/{schema.fr.json → dist/schema.fr.json} +0 -0
- /package/{schema.json → dist/schema.json} +0 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index.cjs2.js');
|
|
4
|
-
|
|
5
3
|
function getPinsBlockDefinition(library, methodData, pinsId) {
|
|
6
4
|
const blockDefinition = {
|
|
7
5
|
type: pinsId,
|
|
@@ -67,14 +65,13 @@ function getPinsBlockDefinition(library, methodData, pinsId) {
|
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
for(let i = 0; i < requiredParamInputs.length; i++){
|
|
70
|
-
var _requiredParamInputs_i_schema, _requiredParamInputs_i_schema_items, _requiredParamInputs_i_schema_items_$ref, _requiredParamInputs_i_schema_items1;
|
|
71
68
|
const position = blockDefinition['args1'].length;
|
|
72
69
|
blockDefinition['args1'].push({
|
|
73
70
|
type: 'field_label',
|
|
74
71
|
name: `NAME_INPUT`,
|
|
75
72
|
text: (requiredParamInputs[i].summary || requiredParamInputs[i].name) + '*'
|
|
76
73
|
});
|
|
77
|
-
if (
|
|
74
|
+
if (requiredParamInputs[i].schema?.type === 'array' && (requiredParamInputs[i].schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || requiredParamInputs[i].schema.items?.$ref?.includes('#/components/schemas/'))) {
|
|
78
75
|
blockDefinition['message1'] += ' %' + (position + 1) + ' %' + (position + 2) + ' %' + (position + 3);
|
|
79
76
|
blockDefinition['args1'].push({
|
|
80
77
|
type: 'input_dummy'
|
|
@@ -144,13 +141,12 @@ function getComponentBlockDefinition(library, componentName, methodData, compone
|
|
|
144
141
|
if (!requiredFields.includes(parameter.name)) {
|
|
145
142
|
mutatorToolbox.push(parameter.name);
|
|
146
143
|
} else {
|
|
147
|
-
var _parameter_schema, _parameter_schema_items, _parameter_schema_items1;
|
|
148
144
|
blockDefinition['args1'].push({
|
|
149
145
|
type: 'field_label',
|
|
150
146
|
name: 'NAME_INPUT',
|
|
151
147
|
text: parameter.summary + '*'
|
|
152
148
|
});
|
|
153
|
-
if (
|
|
149
|
+
if (parameter.schema?.type === 'array' && (parameter.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || parameter.schema.items?.$ref.includes('#/components/schemas/'))) {
|
|
154
150
|
blockDefinition['message1'] += ' %' + (messageIndex * 2 + 1) + ' %' + (messageIndex * 2 + 2) + ' %' + (messageIndex * 2 + 3);
|
|
155
151
|
blockDefinition['args1'].push({
|
|
156
152
|
type: 'input_dummy'
|
|
@@ -177,10 +173,8 @@ function getComponentBlockDefinition(library, componentName, methodData, compone
|
|
|
177
173
|
}
|
|
178
174
|
function generateToolboxFromLibraries(libraries, tags) {
|
|
179
175
|
const sortedLibraries = libraries.sort((a, b)=>{
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
var _b_info_summary;
|
|
183
|
-
const title2 = (_b_info_summary = b.info.summary) != null ? _b_info_summary : b.info.title;
|
|
176
|
+
const title1 = a.info.summary ?? a.info.title;
|
|
177
|
+
const title2 = b.info.summary ?? b.info.title;
|
|
184
178
|
if (title1 < title2) {
|
|
185
179
|
return -1;
|
|
186
180
|
}
|
|
@@ -230,43 +224,86 @@ function generateToolboxFromLibraries(libraries, tags) {
|
|
|
230
224
|
}
|
|
231
225
|
]
|
|
232
226
|
},
|
|
233
|
-
...sortedLibraries.map((library)=>{
|
|
234
|
-
var _library_components;
|
|
235
|
-
var _library_info_summary;
|
|
236
|
-
return {
|
|
227
|
+
...sortedLibraries.map((library)=>({
|
|
237
228
|
kind: 'category',
|
|
238
|
-
name:
|
|
229
|
+
name: library.info.summary ?? library.info.title,
|
|
239
230
|
contents: [
|
|
240
231
|
...library.paths ? Object.entries(library.paths).filter(([_path, pins])=>pins.post.tags.some((tag)=>tags.includes(tag))).sort((a, b)=>a[0].localeCompare(b[0])) // Tri alphabétique par path
|
|
241
232
|
.map(([path, _pins])=>({
|
|
242
233
|
kind: 'block',
|
|
243
234
|
type: library.info.title + '/__PINS__' + path
|
|
244
235
|
})) : [],
|
|
245
|
-
...
|
|
236
|
+
...library.components?.schemas ? Object.entries(library.components.schemas).filter(([_componentName, schema])=>schema.tags.some((tag)=>tags.includes(tag))).sort((a, b)=>a[0].localeCompare(b[0])) // Tri alphabétique par componentName
|
|
246
237
|
.map(([componentName])=>({
|
|
247
238
|
kind: 'block',
|
|
248
239
|
type: library.info.title + '/__COMPONENTS__/' + componentName
|
|
249
240
|
})) : []
|
|
250
241
|
]
|
|
251
|
-
}
|
|
252
|
-
}).filter((library)=>library.contents.length > 0)
|
|
242
|
+
})).filter((library)=>library.contents.length > 0)
|
|
253
243
|
]
|
|
254
244
|
};
|
|
255
245
|
return toolbox;
|
|
256
246
|
}
|
|
257
247
|
function convertPinsLibrariesToBlocklyLibraries(pinsLibraries) {
|
|
258
|
-
return pinsLibraries.map((schema)=>{
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
...path.post
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
248
|
+
return pinsLibraries.map((schema)=>({
|
|
249
|
+
...schema,
|
|
250
|
+
paths: {
|
|
251
|
+
...Object.entries(schema.paths ?? {}).reduce((acc, [key, path])=>({
|
|
252
|
+
...acc,
|
|
253
|
+
[key]: {
|
|
254
|
+
...path,
|
|
255
|
+
post: {
|
|
256
|
+
...path.post,
|
|
257
|
+
parameters: !path.post.parameters ? [] : [
|
|
258
|
+
...path.post.parameters,
|
|
259
|
+
...path.post.parameters.filter((item)=>item.schema?.type === 'array' && (item.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || item.schema.items?.$ref?.includes('#/components/schemas/'))).map((item)=>({
|
|
260
|
+
...item,
|
|
261
|
+
name: item.name + '__EVALUATE',
|
|
262
|
+
summary: (item.summary || item.name) + ' (evaluate)',
|
|
263
|
+
required: false,
|
|
264
|
+
schema: {
|
|
265
|
+
type: 'string'
|
|
266
|
+
}
|
|
267
|
+
}))
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}), {})
|
|
272
|
+
},
|
|
273
|
+
components: !schema.components ? {} : {
|
|
274
|
+
...schema.components,
|
|
275
|
+
schemas: {
|
|
276
|
+
...Object.entries(schema.components.schemas || {}).reduce((acc, [key, component])=>({
|
|
277
|
+
...acc,
|
|
278
|
+
[key]: {
|
|
279
|
+
...component,
|
|
280
|
+
properties: !component.properties ? {} : {
|
|
281
|
+
...component.properties,
|
|
282
|
+
...Object.entries(component.properties).filter(([_propertyKey, propertyValue])=>propertyValue.type === 'array' && (propertyValue.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || propertyValue.items?.$ref?.includes('#/components/schemas/'))).reduce((acc, [propertyKey, property])=>({
|
|
283
|
+
...acc,
|
|
284
|
+
[propertyKey + '__EVALUATE']: {
|
|
285
|
+
...property,
|
|
286
|
+
summary: (property.summary || propertyKey) + ' (evaluate)',
|
|
287
|
+
required: false,
|
|
288
|
+
schema: {
|
|
289
|
+
type: 'string'
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}), {})
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}), {})
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
'x-scene-blocks': {
|
|
299
|
+
...Object.entries(schema['x-scene-blocks'] || {}).reduce((acc, [key, path])=>({
|
|
300
|
+
...acc,
|
|
301
|
+
[key]: {
|
|
302
|
+
...path,
|
|
303
|
+
metadata: !path.metadata ? [] : [
|
|
304
|
+
...path.metadata,
|
|
305
|
+
...path.metadata.filter((item)=>item.schema?.type === 'array' && (item.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || item.schema.items?.$ref?.includes('#/components/schemas/'))).map((item)=>({
|
|
306
|
+
...item,
|
|
270
307
|
name: item.name + '__EVALUATE',
|
|
271
308
|
summary: (item.summary || item.name) + ' (evaluate)',
|
|
272
309
|
required: false,
|
|
@@ -274,62 +311,23 @@ function convertPinsLibrariesToBlocklyLibraries(pinsLibraries) {
|
|
|
274
311
|
type: 'string'
|
|
275
312
|
}
|
|
276
313
|
}))
|
|
277
|
-
]
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
properties: !component.properties ? {} : index._extends({}, component.properties, Object.entries(component.properties).filter(([_propertyKey, propertyValue])=>{
|
|
285
|
-
var _propertyValue_items, _propertyValue_items_$ref, _propertyValue_items1;
|
|
286
|
-
return propertyValue.type === 'array' && (((_propertyValue_items = propertyValue.items) == null ? void 0 : _propertyValue_items.$ref) === 'https://schemas.digipair.ai/pinsSettings' || ((_propertyValue_items1 = propertyValue.items) == null ? void 0 : (_propertyValue_items_$ref = _propertyValue_items1.$ref) == null ? void 0 : _propertyValue_items_$ref.includes('#/components/schemas/')));
|
|
287
|
-
}).reduce((acc, [propertyKey, property])=>index._extends({}, acc, {
|
|
288
|
-
[propertyKey + '__EVALUATE']: index._extends({}, property, {
|
|
289
|
-
summary: (property.summary || propertyKey) + ' (evaluate)',
|
|
314
|
+
],
|
|
315
|
+
parameters: !path.parameters ? [] : [
|
|
316
|
+
...path.parameters,
|
|
317
|
+
...path.parameters.filter((item)=>item.schema?.type === 'array' && (item.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || item.schema.items?.$ref?.includes('#/components/schemas/'))).map((item)=>({
|
|
318
|
+
...item,
|
|
319
|
+
name: item.name + '__EVALUATE',
|
|
320
|
+
summary: (item.summary || item.name) + ' (evaluate)',
|
|
290
321
|
required: false,
|
|
291
322
|
schema: {
|
|
292
323
|
type: 'string'
|
|
293
324
|
}
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
}), {})
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
[key]: index._extends({}, path, {
|
|
301
|
-
metadata: !path.metadata ? [] : [
|
|
302
|
-
...path.metadata,
|
|
303
|
-
...path.metadata.filter((item)=>{
|
|
304
|
-
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
|
305
|
-
return ((_item_schema = item.schema) == null ? void 0 : _item_schema.type) === 'array' && (((_item_schema_items = item.schema.items) == null ? void 0 : _item_schema_items.$ref) === 'https://schemas.digipair.ai/pinsSettings' || ((_item_schema_items1 = item.schema.items) == null ? void 0 : (_item_schema_items_$ref = _item_schema_items1.$ref) == null ? void 0 : _item_schema_items_$ref.includes('#/components/schemas/')));
|
|
306
|
-
}).map((item)=>index._extends({}, item, {
|
|
307
|
-
name: item.name + '__EVALUATE',
|
|
308
|
-
summary: (item.summary || item.name) + ' (evaluate)',
|
|
309
|
-
required: false,
|
|
310
|
-
schema: {
|
|
311
|
-
type: 'string'
|
|
312
|
-
}
|
|
313
|
-
}))
|
|
314
|
-
],
|
|
315
|
-
parameters: !path.parameters ? [] : [
|
|
316
|
-
...path.parameters,
|
|
317
|
-
...path.parameters.filter((item)=>{
|
|
318
|
-
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
|
319
|
-
return ((_item_schema = item.schema) == null ? void 0 : _item_schema.type) === 'array' && (((_item_schema_items = item.schema.items) == null ? void 0 : _item_schema_items.$ref) === 'https://schemas.digipair.ai/pinsSettings' || ((_item_schema_items1 = item.schema.items) == null ? void 0 : (_item_schema_items_$ref = _item_schema_items1.$ref) == null ? void 0 : _item_schema_items_$ref.includes('#/components/schemas/')));
|
|
320
|
-
}).map((item)=>index._extends({}, item, {
|
|
321
|
-
name: item.name + '__EVALUATE',
|
|
322
|
-
summary: (item.summary || item.name) + ' (evaluate)',
|
|
323
|
-
required: false,
|
|
324
|
-
schema: {
|
|
325
|
-
type: 'string'
|
|
326
|
-
}
|
|
327
|
-
}))
|
|
328
|
-
]
|
|
329
|
-
})
|
|
330
|
-
}), {}))
|
|
331
|
-
});
|
|
332
|
-
});
|
|
325
|
+
}))
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
}), {})
|
|
329
|
+
}
|
|
330
|
+
}));
|
|
333
331
|
}
|
|
334
332
|
function generateBlocklyBlockFromLibraries(pinsLibraries, blocksLegacy) {
|
|
335
333
|
const blocksLibrary = [
|
|
@@ -501,11 +499,9 @@ function generateMutator(mutatorName, toolboxItem, requiredFields, originParamet
|
|
|
501
499
|
continue;
|
|
502
500
|
}
|
|
503
501
|
if (!inputLoaded.includes(input.id)) {
|
|
504
|
-
var _parameter_schema, _parameter_schema_items, _parameter_schema_items_$ref, _parameter_schema_items1;
|
|
505
502
|
const id = input.id.indexOf('/') < 0 ? input.id : input.id.split('/')[1];
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
if (((_parameter_schema = parameter.schema) == null ? void 0 : _parameter_schema.type) === 'array' && (((_parameter_schema_items = parameter.schema.items) == null ? void 0 : _parameter_schema_items.$ref) === 'https://schemas.digipair.ai/pinsSettings' || ((_parameter_schema_items1 = parameter.schema.items) == null ? void 0 : (_parameter_schema_items_$ref = _parameter_schema_items1.$ref) == null ? void 0 : _parameter_schema_items_$ref.includes('#/components/schemas/')))) {
|
|
503
|
+
const parameter = parameters.find((param)=>param.name === id) ?? {};
|
|
504
|
+
if (parameter.schema?.type === 'array' && (parameter.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || parameter.schema.items?.$ref?.includes('#/components/schemas/'))) {
|
|
509
505
|
this.appendDummyInput(input.id + '__INPUT').appendField(input.name);
|
|
510
506
|
this.appendStatementInput(input.id);
|
|
511
507
|
} else if (input.id === 'pins') {
|
|
@@ -556,17 +552,15 @@ function getSceneBlockDefinition(library, methodData, sceneBlockId) {
|
|
|
556
552
|
];
|
|
557
553
|
requiredFields.push('');
|
|
558
554
|
// metadata
|
|
559
|
-
for(let i = 0; i <
|
|
560
|
-
|
|
561
|
-
var _metadata_find;
|
|
562
|
-
const parameter = (_metadata_find = metadata.find((param)=>param.name === metadata[i].name)) != null ? _metadata_find : {};
|
|
555
|
+
for(let i = 0; i < metadata?.length; i++){
|
|
556
|
+
const parameter = metadata.find((param)=>param.name === metadata[i].name) ?? {};
|
|
563
557
|
const position = blockDefinition['args1'].length;
|
|
564
558
|
blockDefinition['args1'].push({
|
|
565
559
|
type: 'field_label',
|
|
566
560
|
name: `NAME_INPUT_METADATA`,
|
|
567
561
|
text: (parameter.summary || parameter.name) + '*'
|
|
568
562
|
});
|
|
569
|
-
if (
|
|
563
|
+
if (parameter.schema?.type === 'array' && (parameter.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || parameter.schema.items?.$ref?.includes('#/components/schemas/'))) {
|
|
570
564
|
blockDefinition['message1'] += ' %' + (position + 1) + ' %' + (position + 2) + ' %' + (position + 3);
|
|
571
565
|
blockDefinition['args1'].push({
|
|
572
566
|
type: 'input_dummy'
|
|
@@ -587,16 +581,14 @@ function getSceneBlockDefinition(library, methodData, sceneBlockId) {
|
|
|
587
581
|
const mutatorToolbox = parameters.map((param)=>param.name).filter((name)=>!requiredFields.includes(name));
|
|
588
582
|
// parameters
|
|
589
583
|
for(let i = 0; i < requiredParamInputs.length; i++){
|
|
590
|
-
|
|
591
|
-
var _parameters_find;
|
|
592
|
-
const parameter = (_parameters_find = parameters.find((param)=>param.name === requiredParamInputs[i].name)) != null ? _parameters_find : {};
|
|
584
|
+
const parameter = parameters.find((param)=>param.name === requiredParamInputs[i].name) ?? {};
|
|
593
585
|
const position = blockDefinition['args3'].length;
|
|
594
586
|
blockDefinition['args3'].push({
|
|
595
587
|
type: 'field_label',
|
|
596
588
|
name: `NAME_INPUT`,
|
|
597
589
|
text: (parameter.summary || parameter.name) + '*'
|
|
598
590
|
});
|
|
599
|
-
if (
|
|
591
|
+
if (parameter.schema?.type === 'array' && (parameter.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || parameter.schema.items?.$ref?.includes('#/components/schemas/'))) {
|
|
600
592
|
blockDefinition['message3'] += ' %' + (position + 1) + ' %' + (position + 2) + ' %' + (position + 3);
|
|
601
593
|
blockDefinition['args3'].push({
|
|
602
594
|
type: 'input_dummy'
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _extends } from './index.esm2.js';
|
|
2
|
-
|
|
3
1
|
function getPinsBlockDefinition(library, methodData, pinsId) {
|
|
4
2
|
const blockDefinition = {
|
|
5
3
|
type: pinsId,
|
|
@@ -65,14 +63,13 @@ function getPinsBlockDefinition(library, methodData, pinsId) {
|
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
for(let i = 0; i < requiredParamInputs.length; i++){
|
|
68
|
-
var _requiredParamInputs_i_schema, _requiredParamInputs_i_schema_items, _requiredParamInputs_i_schema_items_$ref, _requiredParamInputs_i_schema_items1;
|
|
69
66
|
const position = blockDefinition['args1'].length;
|
|
70
67
|
blockDefinition['args1'].push({
|
|
71
68
|
type: 'field_label',
|
|
72
69
|
name: `NAME_INPUT`,
|
|
73
70
|
text: (requiredParamInputs[i].summary || requiredParamInputs[i].name) + '*'
|
|
74
71
|
});
|
|
75
|
-
if (
|
|
72
|
+
if (requiredParamInputs[i].schema?.type === 'array' && (requiredParamInputs[i].schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || requiredParamInputs[i].schema.items?.$ref?.includes('#/components/schemas/'))) {
|
|
76
73
|
blockDefinition['message1'] += ' %' + (position + 1) + ' %' + (position + 2) + ' %' + (position + 3);
|
|
77
74
|
blockDefinition['args1'].push({
|
|
78
75
|
type: 'input_dummy'
|
|
@@ -142,13 +139,12 @@ function getComponentBlockDefinition(library, componentName, methodData, compone
|
|
|
142
139
|
if (!requiredFields.includes(parameter.name)) {
|
|
143
140
|
mutatorToolbox.push(parameter.name);
|
|
144
141
|
} else {
|
|
145
|
-
var _parameter_schema, _parameter_schema_items, _parameter_schema_items1;
|
|
146
142
|
blockDefinition['args1'].push({
|
|
147
143
|
type: 'field_label',
|
|
148
144
|
name: 'NAME_INPUT',
|
|
149
145
|
text: parameter.summary + '*'
|
|
150
146
|
});
|
|
151
|
-
if (
|
|
147
|
+
if (parameter.schema?.type === 'array' && (parameter.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || parameter.schema.items?.$ref.includes('#/components/schemas/'))) {
|
|
152
148
|
blockDefinition['message1'] += ' %' + (messageIndex * 2 + 1) + ' %' + (messageIndex * 2 + 2) + ' %' + (messageIndex * 2 + 3);
|
|
153
149
|
blockDefinition['args1'].push({
|
|
154
150
|
type: 'input_dummy'
|
|
@@ -175,10 +171,8 @@ function getComponentBlockDefinition(library, componentName, methodData, compone
|
|
|
175
171
|
}
|
|
176
172
|
function generateToolboxFromLibraries(libraries, tags) {
|
|
177
173
|
const sortedLibraries = libraries.sort((a, b)=>{
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
var _b_info_summary;
|
|
181
|
-
const title2 = (_b_info_summary = b.info.summary) != null ? _b_info_summary : b.info.title;
|
|
174
|
+
const title1 = a.info.summary ?? a.info.title;
|
|
175
|
+
const title2 = b.info.summary ?? b.info.title;
|
|
182
176
|
if (title1 < title2) {
|
|
183
177
|
return -1;
|
|
184
178
|
}
|
|
@@ -228,43 +222,86 @@ function generateToolboxFromLibraries(libraries, tags) {
|
|
|
228
222
|
}
|
|
229
223
|
]
|
|
230
224
|
},
|
|
231
|
-
...sortedLibraries.map((library)=>{
|
|
232
|
-
var _library_components;
|
|
233
|
-
var _library_info_summary;
|
|
234
|
-
return {
|
|
225
|
+
...sortedLibraries.map((library)=>({
|
|
235
226
|
kind: 'category',
|
|
236
|
-
name:
|
|
227
|
+
name: library.info.summary ?? library.info.title,
|
|
237
228
|
contents: [
|
|
238
229
|
...library.paths ? Object.entries(library.paths).filter(([_path, pins])=>pins.post.tags.some((tag)=>tags.includes(tag))).sort((a, b)=>a[0].localeCompare(b[0])) // Tri alphabétique par path
|
|
239
230
|
.map(([path, _pins])=>({
|
|
240
231
|
kind: 'block',
|
|
241
232
|
type: library.info.title + '/__PINS__' + path
|
|
242
233
|
})) : [],
|
|
243
|
-
...
|
|
234
|
+
...library.components?.schemas ? Object.entries(library.components.schemas).filter(([_componentName, schema])=>schema.tags.some((tag)=>tags.includes(tag))).sort((a, b)=>a[0].localeCompare(b[0])) // Tri alphabétique par componentName
|
|
244
235
|
.map(([componentName])=>({
|
|
245
236
|
kind: 'block',
|
|
246
237
|
type: library.info.title + '/__COMPONENTS__/' + componentName
|
|
247
238
|
})) : []
|
|
248
239
|
]
|
|
249
|
-
}
|
|
250
|
-
}).filter((library)=>library.contents.length > 0)
|
|
240
|
+
})).filter((library)=>library.contents.length > 0)
|
|
251
241
|
]
|
|
252
242
|
};
|
|
253
243
|
return toolbox;
|
|
254
244
|
}
|
|
255
245
|
function convertPinsLibrariesToBlocklyLibraries(pinsLibraries) {
|
|
256
|
-
return pinsLibraries.map((schema)=>{
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
...path.post
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
246
|
+
return pinsLibraries.map((schema)=>({
|
|
247
|
+
...schema,
|
|
248
|
+
paths: {
|
|
249
|
+
...Object.entries(schema.paths ?? {}).reduce((acc, [key, path])=>({
|
|
250
|
+
...acc,
|
|
251
|
+
[key]: {
|
|
252
|
+
...path,
|
|
253
|
+
post: {
|
|
254
|
+
...path.post,
|
|
255
|
+
parameters: !path.post.parameters ? [] : [
|
|
256
|
+
...path.post.parameters,
|
|
257
|
+
...path.post.parameters.filter((item)=>item.schema?.type === 'array' && (item.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || item.schema.items?.$ref?.includes('#/components/schemas/'))).map((item)=>({
|
|
258
|
+
...item,
|
|
259
|
+
name: item.name + '__EVALUATE',
|
|
260
|
+
summary: (item.summary || item.name) + ' (evaluate)',
|
|
261
|
+
required: false,
|
|
262
|
+
schema: {
|
|
263
|
+
type: 'string'
|
|
264
|
+
}
|
|
265
|
+
}))
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}), {})
|
|
270
|
+
},
|
|
271
|
+
components: !schema.components ? {} : {
|
|
272
|
+
...schema.components,
|
|
273
|
+
schemas: {
|
|
274
|
+
...Object.entries(schema.components.schemas || {}).reduce((acc, [key, component])=>({
|
|
275
|
+
...acc,
|
|
276
|
+
[key]: {
|
|
277
|
+
...component,
|
|
278
|
+
properties: !component.properties ? {} : {
|
|
279
|
+
...component.properties,
|
|
280
|
+
...Object.entries(component.properties).filter(([_propertyKey, propertyValue])=>propertyValue.type === 'array' && (propertyValue.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || propertyValue.items?.$ref?.includes('#/components/schemas/'))).reduce((acc, [propertyKey, property])=>({
|
|
281
|
+
...acc,
|
|
282
|
+
[propertyKey + '__EVALUATE']: {
|
|
283
|
+
...property,
|
|
284
|
+
summary: (property.summary || propertyKey) + ' (evaluate)',
|
|
285
|
+
required: false,
|
|
286
|
+
schema: {
|
|
287
|
+
type: 'string'
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}), {})
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}), {})
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
'x-scene-blocks': {
|
|
297
|
+
...Object.entries(schema['x-scene-blocks'] || {}).reduce((acc, [key, path])=>({
|
|
298
|
+
...acc,
|
|
299
|
+
[key]: {
|
|
300
|
+
...path,
|
|
301
|
+
metadata: !path.metadata ? [] : [
|
|
302
|
+
...path.metadata,
|
|
303
|
+
...path.metadata.filter((item)=>item.schema?.type === 'array' && (item.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || item.schema.items?.$ref?.includes('#/components/schemas/'))).map((item)=>({
|
|
304
|
+
...item,
|
|
268
305
|
name: item.name + '__EVALUATE',
|
|
269
306
|
summary: (item.summary || item.name) + ' (evaluate)',
|
|
270
307
|
required: false,
|
|
@@ -272,62 +309,23 @@ function convertPinsLibrariesToBlocklyLibraries(pinsLibraries) {
|
|
|
272
309
|
type: 'string'
|
|
273
310
|
}
|
|
274
311
|
}))
|
|
275
|
-
]
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
properties: !component.properties ? {} : _extends({}, component.properties, Object.entries(component.properties).filter(([_propertyKey, propertyValue])=>{
|
|
283
|
-
var _propertyValue_items, _propertyValue_items_$ref, _propertyValue_items1;
|
|
284
|
-
return propertyValue.type === 'array' && (((_propertyValue_items = propertyValue.items) == null ? void 0 : _propertyValue_items.$ref) === 'https://schemas.digipair.ai/pinsSettings' || ((_propertyValue_items1 = propertyValue.items) == null ? void 0 : (_propertyValue_items_$ref = _propertyValue_items1.$ref) == null ? void 0 : _propertyValue_items_$ref.includes('#/components/schemas/')));
|
|
285
|
-
}).reduce((acc, [propertyKey, property])=>_extends({}, acc, {
|
|
286
|
-
[propertyKey + '__EVALUATE']: _extends({}, property, {
|
|
287
|
-
summary: (property.summary || propertyKey) + ' (evaluate)',
|
|
312
|
+
],
|
|
313
|
+
parameters: !path.parameters ? [] : [
|
|
314
|
+
...path.parameters,
|
|
315
|
+
...path.parameters.filter((item)=>item.schema?.type === 'array' && (item.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || item.schema.items?.$ref?.includes('#/components/schemas/'))).map((item)=>({
|
|
316
|
+
...item,
|
|
317
|
+
name: item.name + '__EVALUATE',
|
|
318
|
+
summary: (item.summary || item.name) + ' (evaluate)',
|
|
288
319
|
required: false,
|
|
289
320
|
schema: {
|
|
290
321
|
type: 'string'
|
|
291
322
|
}
|
|
292
|
-
})
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
}), {})
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
[key]: _extends({}, path, {
|
|
299
|
-
metadata: !path.metadata ? [] : [
|
|
300
|
-
...path.metadata,
|
|
301
|
-
...path.metadata.filter((item)=>{
|
|
302
|
-
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
|
303
|
-
return ((_item_schema = item.schema) == null ? void 0 : _item_schema.type) === 'array' && (((_item_schema_items = item.schema.items) == null ? void 0 : _item_schema_items.$ref) === 'https://schemas.digipair.ai/pinsSettings' || ((_item_schema_items1 = item.schema.items) == null ? void 0 : (_item_schema_items_$ref = _item_schema_items1.$ref) == null ? void 0 : _item_schema_items_$ref.includes('#/components/schemas/')));
|
|
304
|
-
}).map((item)=>_extends({}, item, {
|
|
305
|
-
name: item.name + '__EVALUATE',
|
|
306
|
-
summary: (item.summary || item.name) + ' (evaluate)',
|
|
307
|
-
required: false,
|
|
308
|
-
schema: {
|
|
309
|
-
type: 'string'
|
|
310
|
-
}
|
|
311
|
-
}))
|
|
312
|
-
],
|
|
313
|
-
parameters: !path.parameters ? [] : [
|
|
314
|
-
...path.parameters,
|
|
315
|
-
...path.parameters.filter((item)=>{
|
|
316
|
-
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
|
317
|
-
return ((_item_schema = item.schema) == null ? void 0 : _item_schema.type) === 'array' && (((_item_schema_items = item.schema.items) == null ? void 0 : _item_schema_items.$ref) === 'https://schemas.digipair.ai/pinsSettings' || ((_item_schema_items1 = item.schema.items) == null ? void 0 : (_item_schema_items_$ref = _item_schema_items1.$ref) == null ? void 0 : _item_schema_items_$ref.includes('#/components/schemas/')));
|
|
318
|
-
}).map((item)=>_extends({}, item, {
|
|
319
|
-
name: item.name + '__EVALUATE',
|
|
320
|
-
summary: (item.summary || item.name) + ' (evaluate)',
|
|
321
|
-
required: false,
|
|
322
|
-
schema: {
|
|
323
|
-
type: 'string'
|
|
324
|
-
}
|
|
325
|
-
}))
|
|
326
|
-
]
|
|
327
|
-
})
|
|
328
|
-
}), {}))
|
|
329
|
-
});
|
|
330
|
-
});
|
|
323
|
+
}))
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
}), {})
|
|
327
|
+
}
|
|
328
|
+
}));
|
|
331
329
|
}
|
|
332
330
|
function generateBlocklyBlockFromLibraries(pinsLibraries, blocksLegacy) {
|
|
333
331
|
const blocksLibrary = [
|
|
@@ -499,11 +497,9 @@ function generateMutator(mutatorName, toolboxItem, requiredFields, originParamet
|
|
|
499
497
|
continue;
|
|
500
498
|
}
|
|
501
499
|
if (!inputLoaded.includes(input.id)) {
|
|
502
|
-
var _parameter_schema, _parameter_schema_items, _parameter_schema_items_$ref, _parameter_schema_items1;
|
|
503
500
|
const id = input.id.indexOf('/') < 0 ? input.id : input.id.split('/')[1];
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (((_parameter_schema = parameter.schema) == null ? void 0 : _parameter_schema.type) === 'array' && (((_parameter_schema_items = parameter.schema.items) == null ? void 0 : _parameter_schema_items.$ref) === 'https://schemas.digipair.ai/pinsSettings' || ((_parameter_schema_items1 = parameter.schema.items) == null ? void 0 : (_parameter_schema_items_$ref = _parameter_schema_items1.$ref) == null ? void 0 : _parameter_schema_items_$ref.includes('#/components/schemas/')))) {
|
|
501
|
+
const parameter = parameters.find((param)=>param.name === id) ?? {};
|
|
502
|
+
if (parameter.schema?.type === 'array' && (parameter.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || parameter.schema.items?.$ref?.includes('#/components/schemas/'))) {
|
|
507
503
|
this.appendDummyInput(input.id + '__INPUT').appendField(input.name);
|
|
508
504
|
this.appendStatementInput(input.id);
|
|
509
505
|
} else if (input.id === 'pins') {
|
|
@@ -554,17 +550,15 @@ function getSceneBlockDefinition(library, methodData, sceneBlockId) {
|
|
|
554
550
|
];
|
|
555
551
|
requiredFields.push('');
|
|
556
552
|
// metadata
|
|
557
|
-
for(let i = 0; i <
|
|
558
|
-
|
|
559
|
-
var _metadata_find;
|
|
560
|
-
const parameter = (_metadata_find = metadata.find((param)=>param.name === metadata[i].name)) != null ? _metadata_find : {};
|
|
553
|
+
for(let i = 0; i < metadata?.length; i++){
|
|
554
|
+
const parameter = metadata.find((param)=>param.name === metadata[i].name) ?? {};
|
|
561
555
|
const position = blockDefinition['args1'].length;
|
|
562
556
|
blockDefinition['args1'].push({
|
|
563
557
|
type: 'field_label',
|
|
564
558
|
name: `NAME_INPUT_METADATA`,
|
|
565
559
|
text: (parameter.summary || parameter.name) + '*'
|
|
566
560
|
});
|
|
567
|
-
if (
|
|
561
|
+
if (parameter.schema?.type === 'array' && (parameter.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || parameter.schema.items?.$ref?.includes('#/components/schemas/'))) {
|
|
568
562
|
blockDefinition['message1'] += ' %' + (position + 1) + ' %' + (position + 2) + ' %' + (position + 3);
|
|
569
563
|
blockDefinition['args1'].push({
|
|
570
564
|
type: 'input_dummy'
|
|
@@ -585,16 +579,14 @@ function getSceneBlockDefinition(library, methodData, sceneBlockId) {
|
|
|
585
579
|
const mutatorToolbox = parameters.map((param)=>param.name).filter((name)=>!requiredFields.includes(name));
|
|
586
580
|
// parameters
|
|
587
581
|
for(let i = 0; i < requiredParamInputs.length; i++){
|
|
588
|
-
|
|
589
|
-
var _parameters_find;
|
|
590
|
-
const parameter = (_parameters_find = parameters.find((param)=>param.name === requiredParamInputs[i].name)) != null ? _parameters_find : {};
|
|
582
|
+
const parameter = parameters.find((param)=>param.name === requiredParamInputs[i].name) ?? {};
|
|
591
583
|
const position = blockDefinition['args3'].length;
|
|
592
584
|
blockDefinition['args3'].push({
|
|
593
585
|
type: 'field_label',
|
|
594
586
|
name: `NAME_INPUT`,
|
|
595
587
|
text: (parameter.summary || parameter.name) + '*'
|
|
596
588
|
});
|
|
597
|
-
if (
|
|
589
|
+
if (parameter.schema?.type === 'array' && (parameter.schema.items?.$ref === 'https://schemas.digipair.ai/pinsSettings' || parameter.schema.items?.$ref?.includes('#/components/schemas/'))) {
|
|
598
590
|
blockDefinition['message3'] += ' %' + (position + 1) + ' %' + (position + 2) + ' %' + (position + 3);
|
|
599
591
|
blockDefinition['args3'].push({
|
|
600
592
|
type: 'input_dummy'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../../src/lib/blocks/json.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgJxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.element.d.ts","sourceRoot":"","sources":["../../../src/lib/editor.element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAQ,MAAM,KAAK,CAAC;AAcvD,qBACa,aAAc,SAAQ,UAAU;IAE3C,SAAS,EAAG,GAAG,CAAC;IAGhB,OAAO,EAAE,GAAG,EAAE,CAAM;IAGpB,SAAS,SAAW;IAGpB,mBAAmB,SAAuB;IAG1C,YAAY,SAA4D;IAGxE,QAAQ,SAAQ;IAGhB,OAAO,UAAS;IAGhB,eAAe,EAAE,GAAG,CAAC;IAErB,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,eAAe,CAAM;IAEpB,gBAAgB;IAIhB,iBAAiB,IAAI,IAAI;YAKpB,UAAU;IA6CxB,OAAO,CAAC,aAAa;YAOP,YAAY;YAMZ,SAAS;IAWvB,OAAO,CAAC,uBAAuB;IAgB/B,OAAO,CAAC,WAAW;IAuFV,MAAM,IAAI,cAAc;CAqDlC"}
|