@digipair/skill-web-editor 0.72.2 → 0.72.3
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/blockly-to-json.cjs.js +4 -4
- package/blockly-to-json.esm.js +4 -4
- package/index.cjs2.js +71 -33
- package/index.esm2.js +71 -33
- package/package.json +1 -1
- package/pins-to-blockly.cjs.js +76 -3
- package/pins-to-blockly.esm.js +76 -3
package/blockly-to-json.cjs.js
CHANGED
@@ -150,9 +150,9 @@ jsonGenerator.generatePin = function(block) {
|
|
150
150
|
if (inputName === 'pins') {
|
151
151
|
code += ` "${inputName}": [${inputCode}],`;
|
152
152
|
} else if (inputName.includes('__CONDITION__/')) {
|
153
|
-
conditionCode += ` "${inputName.split('__CONDITION__/')[1]}": ${inputCode},`;
|
153
|
+
conditionCode += ` "${inputName.split('__CONDITION__/')[1].replace(/__EVALUATE$/g, '')}": ${inputCode},`;
|
154
154
|
} else if (codeToAdd !== 'undefined') {
|
155
|
-
propertiesCode += ` "${inputName}": ${codeToAdd},`;
|
155
|
+
propertiesCode += ` "${inputName.replace(/__EVALUATE$/g, '')}": ${codeToAdd},`;
|
156
156
|
}
|
157
157
|
}
|
158
158
|
}
|
@@ -198,7 +198,7 @@ jsonGenerator.generateComponent = function(block) {
|
|
198
198
|
codeToAdd = getCodeFromBlock(connectedBlock);
|
199
199
|
}
|
200
200
|
if (codeToAdd !== 'undefined') {
|
201
|
-
code += ` "${inputName}": ${codeToAdd},`;
|
201
|
+
code += ` "${inputName.replace(/__EVALUATE$/g, '')}": ${codeToAdd},`;
|
202
202
|
}
|
203
203
|
}
|
204
204
|
}
|
@@ -291,7 +291,7 @@ jsonGenerator.generateSceneBlock = function(block) {
|
|
291
291
|
const name = isMetadata ? input.name.replace('metadata--', '') : input.name;
|
292
292
|
const fieldValue = valueToCode(block, input);
|
293
293
|
if (fieldValue) {
|
294
|
-
target[name] = safeParse(fieldValue, {});
|
294
|
+
target[name.replace(/__EVALUATE$/g, '')] = safeParse(fieldValue, {});
|
295
295
|
}
|
296
296
|
}
|
297
297
|
});
|
package/blockly-to-json.esm.js
CHANGED
@@ -148,9 +148,9 @@ jsonGenerator.generatePin = function(block) {
|
|
148
148
|
if (inputName === 'pins') {
|
149
149
|
code += ` "${inputName}": [${inputCode}],`;
|
150
150
|
} else if (inputName.includes('__CONDITION__/')) {
|
151
|
-
conditionCode += ` "${inputName.split('__CONDITION__/')[1]}": ${inputCode},`;
|
151
|
+
conditionCode += ` "${inputName.split('__CONDITION__/')[1].replace(/__EVALUATE$/g, '')}": ${inputCode},`;
|
152
152
|
} else if (codeToAdd !== 'undefined') {
|
153
|
-
propertiesCode += ` "${inputName}": ${codeToAdd},`;
|
153
|
+
propertiesCode += ` "${inputName.replace(/__EVALUATE$/g, '')}": ${codeToAdd},`;
|
154
154
|
}
|
155
155
|
}
|
156
156
|
}
|
@@ -196,7 +196,7 @@ jsonGenerator.generateComponent = function(block) {
|
|
196
196
|
codeToAdd = getCodeFromBlock(connectedBlock);
|
197
197
|
}
|
198
198
|
if (codeToAdd !== 'undefined') {
|
199
|
-
code += ` "${inputName}": ${codeToAdd},`;
|
199
|
+
code += ` "${inputName.replace(/__EVALUATE$/g, '')}": ${codeToAdd},`;
|
200
200
|
}
|
201
201
|
}
|
202
202
|
}
|
@@ -289,7 +289,7 @@ jsonGenerator.generateSceneBlock = function(block) {
|
|
289
289
|
const name = isMetadata ? input.name.replace('metadata--', '') : input.name;
|
290
290
|
const fieldValue = valueToCode(block, input);
|
291
291
|
if (fieldValue) {
|
292
|
-
target[name] = safeParse(fieldValue, {});
|
292
|
+
target[name.replace(/__EVALUATE$/g, '')] = safeParse(fieldValue, {});
|
293
293
|
}
|
294
294
|
}
|
295
295
|
});
|
package/index.cjs2.js
CHANGED
@@ -2114,6 +2114,14 @@ function generateSceneBlock(pinsSettings, workspace) {
|
|
2114
2114
|
if (parameter) {
|
2115
2115
|
if (parameter.schema.type === 'array' && parameter.schema.items.$ref) {
|
2116
2116
|
const parameterType = getParameterType(parameter.schema.items);
|
2117
|
+
if (typeof metadataValue === 'string') {
|
2118
|
+
const metadataBlock = generateParameterBlock({
|
2119
|
+
type: 'string'
|
2120
|
+
}, metadataValue, workspace, foundLibrary);
|
2121
|
+
const sceneInputConnection = sceneBlock.getInput(inputName + '__EVALUATE').connection;
|
2122
|
+
connectBlock(metadataBlock, sceneInputConnection);
|
2123
|
+
continue;
|
2124
|
+
}
|
2117
2125
|
for (const componentSettings of metadataValue.reverse()){
|
2118
2126
|
const componentBlock = parameterType === 'component' ? generateBlockFromComponent(componentSettings, workspace, foundLibrary, parameter.schema.items.$ref) : generateBlockFromPins(componentSettings, workspace);
|
2119
2127
|
const sceneInputConnection = sceneBlock.getInput(inputName).connection;
|
@@ -2141,6 +2149,14 @@ function generateSceneBlock(pinsSettings, workspace) {
|
|
2141
2149
|
if (parameter) {
|
2142
2150
|
if (parameter.schema.type === 'array' && parameter.schema.items.$ref) {
|
2143
2151
|
const parameterType = getParameterType(parameter.schema.items);
|
2152
|
+
if (typeof value === 'string') {
|
2153
|
+
const metadataBlock = generateParameterBlock({
|
2154
|
+
type: 'string'
|
2155
|
+
}, value, workspace, foundLibrary);
|
2156
|
+
const sceneInputConnection = sceneBlock.getInput(inputName + '__EVALUATE').connection;
|
2157
|
+
connectBlock(metadataBlock, sceneInputConnection);
|
2158
|
+
continue;
|
2159
|
+
}
|
2144
2160
|
for (const componentSettings of value.reverse()){
|
2145
2161
|
const componentBlock = parameterType === 'component' ? generateBlockFromComponent(componentSettings, workspace, foundLibrary, parameter.schema.items.$ref) : generateBlockFromPins(componentSettings, workspace);
|
2146
2162
|
const sceneInputConnection = sceneBlock.getInput(inputName).connection;
|
@@ -2228,7 +2244,9 @@ function generateBlockFromPins(pinsSettings, workspace) {
|
|
2228
2244
|
if (parameter.schema.type === 'array' && parameter.schema.items.$ref) {
|
2229
2245
|
const parameterType = getParameterType(parameter.schema.items);
|
2230
2246
|
if (typeof valueToLoad === 'string') {
|
2231
|
-
const parameterBlock = generateParameterBlock(
|
2247
|
+
const parameterBlock = generateParameterBlock({
|
2248
|
+
type: 'string'
|
2249
|
+
}, valueToLoad, workspace, library);
|
2232
2250
|
const inputConnection = pinsBlock.getInput(parameter.name + '__EVALUATE').connection;
|
2233
2251
|
connectBlock(parameterBlock, inputConnection);
|
2234
2252
|
continue;
|
@@ -2273,13 +2291,31 @@ function generateBlockFromPins(pinsSettings, workspace) {
|
|
2273
2291
|
}
|
2274
2292
|
];
|
2275
2293
|
for (const parameter of conditions){
|
2294
|
+
var _parameter_schema_items;
|
2276
2295
|
if (!pinsSettings.conditions || !Object.prototype.hasOwnProperty.call(pinsSettings.conditions, parameter.name)) {
|
2277
2296
|
continue;
|
2278
2297
|
}
|
2279
2298
|
const valueToLoad = pinsSettings.conditions[parameter.name];
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2299
|
+
if (parameter.schema.type === 'array' && ((_parameter_schema_items = parameter.schema.items) == null ? void 0 : _parameter_schema_items.$ref)) {
|
2300
|
+
const parameterType = getParameterType(parameter.schema.items);
|
2301
|
+
if (typeof valueToLoad === 'string') {
|
2302
|
+
const parameterBlock = generateParameterBlock({
|
2303
|
+
type: 'string'
|
2304
|
+
}, valueToLoad, workspace, library);
|
2305
|
+
const inputConnection = pinsBlock.getInput('__CONDITION__/' + parameter.name + '__EVALUATE').connection;
|
2306
|
+
connectBlock(parameterBlock, inputConnection);
|
2307
|
+
continue;
|
2308
|
+
}
|
2309
|
+
for (const propertyValue of valueToLoad.reverse()){
|
2310
|
+
const parameterBlock = parameterType === 'component' ? generateBlockFromComponent(propertyValue, workspace, library, parameter.schema.items.$ref) : generateBlockFromPins(propertyValue, workspace);
|
2311
|
+
const inputConnection = pinsBlock.getInput('__CONDITION__/' + parameter.name).connection;
|
2312
|
+
connectBlock(parameterBlock, inputConnection);
|
2313
|
+
}
|
2314
|
+
} else {
|
2315
|
+
const parameterBlock = generateParameterBlock(parameter.schema, valueToLoad, workspace, library);
|
2316
|
+
const inputConnection = pinsBlock.getInput('__CONDITION__/' + parameter.name).connection;
|
2317
|
+
connectBlock(parameterBlock, inputConnection);
|
2318
|
+
}
|
2283
2319
|
}
|
2284
2320
|
return pinsBlock;
|
2285
2321
|
}
|
@@ -2307,15 +2343,23 @@ function generateBlockFromComponent(componentSettings, workspace, library, compo
|
|
2307
2343
|
const valueToLoad = componentSettings[propertyKey];
|
2308
2344
|
if (schema.type === 'array' && schema.items.$ref) {
|
2309
2345
|
const parameterType = getParameterType(schema.items);
|
2346
|
+
if (typeof valueToLoad === 'string') {
|
2347
|
+
const parameterBlock = generateParameterBlock({
|
2348
|
+
type: 'string'
|
2349
|
+
}, valueToLoad, workspace, library);
|
2350
|
+
const componentInputConnection = componentBlock.getInput(propertyKey + '__EVALUATE').connection;
|
2351
|
+
connectBlock(parameterBlock, componentInputConnection);
|
2352
|
+
continue;
|
2353
|
+
}
|
2310
2354
|
for (const propertyValue of valueToLoad.reverse()){
|
2311
2355
|
const parameterBlock = parameterType === 'component' ? generateBlockFromComponent(propertyValue, workspace, library, schema.items.$ref) : generateBlockFromPins(propertyValue, workspace);
|
2312
|
-
const
|
2313
|
-
connectBlock(parameterBlock,
|
2356
|
+
const componentInputConnection = componentBlock.getInput(propertyKey).connection;
|
2357
|
+
connectBlock(parameterBlock, componentInputConnection);
|
2314
2358
|
}
|
2315
2359
|
} else {
|
2316
2360
|
const parameterBlock = generateParameterBlock(schema, valueToLoad, workspace, library);
|
2317
|
-
const
|
2318
|
-
connectBlock(parameterBlock,
|
2361
|
+
const componentInputConnection = componentBlock.getInput(propertyKey).connection;
|
2362
|
+
connectBlock(parameterBlock, componentInputConnection);
|
2319
2363
|
}
|
2320
2364
|
}
|
2321
2365
|
componentBlock.render();
|
@@ -2491,12 +2535,16 @@ function itemListFromPinsSettings(pinsSettings, pinsDefinition) {
|
|
2491
2535
|
}
|
2492
2536
|
if (pinsDefinition.parameters && pinsSettings.properties) {
|
2493
2537
|
for (const parameter of pinsDefinition.parameters){
|
2538
|
+
var _parameter_schema, _parameter_schema_items, _parameter_schema_items_$ref, _parameter_schema_items1;
|
2494
2539
|
if (!Object.prototype.hasOwnProperty.call(pinsSettings.properties, parameter.name)) {
|
2495
2540
|
continue;
|
2496
2541
|
}
|
2542
|
+
const isEvaluate = ((_parameter_schema = parameter.schema) == null ? void 0 : _parameter_schema.type) === 'array' && typeof pinsSettings.properties[parameter.name] === 'string' && (((_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/')));
|
2543
|
+
const name = isEvaluate ? parameter.name + '__EVALUATE' : parameter.name;
|
2544
|
+
const summary = isEvaluate ? (parameter.summary || parameter.name) + ' (evaluate)' : parameter.summary || parameter.name;
|
2497
2545
|
inputArray.push({
|
2498
|
-
id:
|
2499
|
-
name:
|
2546
|
+
id: name,
|
2547
|
+
name: summary
|
2500
2548
|
});
|
2501
2549
|
}
|
2502
2550
|
}
|
@@ -2536,12 +2584,16 @@ function itemListFromPinsSettings(pinsSettings, pinsDefinition) {
|
|
2536
2584
|
function itemListFromComponentSettings(componentSettings, componentDefinition) {
|
2537
2585
|
const inputArray = [];
|
2538
2586
|
for (const [propertyKey, propertyValue] of Object.entries(componentDefinition.properties)){
|
2587
|
+
var _propertyValue_items, _propertyValue_items_$ref, _propertyValue_items1;
|
2539
2588
|
if (!Object.prototype.hasOwnProperty.call(componentSettings, propertyKey) || propertyValue.type === 'array' && (!componentSettings[propertyKey] || componentSettings[propertyKey].length === 0)) {
|
2540
2589
|
continue;
|
2541
2590
|
}
|
2591
|
+
const isEvaluate = propertyValue.type === 'array' && typeof componentSettings[propertyKey] === 'string' && (((_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/')));
|
2592
|
+
const name = isEvaluate ? propertyKey + '__EVALUATE' : propertyKey;
|
2593
|
+
const summary = isEvaluate ? (propertyValue.summary || propertyKey) + ' (evaluate)' : propertyValue.summary || propertyKey;
|
2542
2594
|
inputArray.push({
|
2543
|
-
id:
|
2544
|
-
name:
|
2595
|
+
id: name,
|
2596
|
+
name: summary
|
2545
2597
|
});
|
2546
2598
|
}
|
2547
2599
|
return inputArray;
|
@@ -2550,12 +2602,16 @@ function itemListFromSceneSettings(sceneSettings, sceneDefinition) {
|
|
2550
2602
|
const inputArray = [];
|
2551
2603
|
if (sceneDefinition.parameters && sceneSettings.properties) {
|
2552
2604
|
for (const parameter of sceneDefinition.parameters){
|
2605
|
+
var _parameter_schema, _parameter_schema_items, _parameter_schema_items_$ref, _parameter_schema_items1;
|
2553
2606
|
if (!Object.prototype.hasOwnProperty.call(sceneSettings.properties, parameter.name)) {
|
2554
2607
|
continue;
|
2555
2608
|
}
|
2609
|
+
const isEvaluate = ((_parameter_schema = parameter.schema) == null ? void 0 : _parameter_schema.type) === 'array' && typeof sceneSettings.properties[parameter.name] === 'string' && (((_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/')));
|
2610
|
+
const name = isEvaluate ? parameter.name + '__EVALUATE' : parameter.name;
|
2611
|
+
const summary = isEvaluate ? (parameter.summary || parameter.name) + ' (evaluate)' : parameter.summary || parameter.name;
|
2556
2612
|
inputArray.push({
|
2557
|
-
id:
|
2558
|
-
name:
|
2613
|
+
id: name,
|
2614
|
+
name: summary
|
2559
2615
|
});
|
2560
2616
|
}
|
2561
2617
|
}
|
@@ -72338,25 +72394,7 @@ class EditorElement extends r$1 {
|
|
72338
72394
|
const list = [
|
72339
72395
|
this.language === 'fr' ? schemas : schemas$1,
|
72340
72396
|
...this.schemas
|
72341
|
-
]
|
72342
|
-
paths: _extends({}, schema.paths.map((path)=>_extends({}, path, {
|
72343
|
-
post: _extends({}, path.post, {
|
72344
|
-
parameters: [
|
72345
|
-
...path.post.parameters,
|
72346
|
-
...path.post.parameters.filter((item)=>{
|
72347
|
-
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
72348
|
-
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) === '#/components/schemas/Block' || ((_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/'))).map((item)=>_extends({}, item, {
|
72349
|
-
name: item.name + '__EVALUATE',
|
72350
|
-
summary: item.summary + ' (evaluate)',
|
72351
|
-
schema: {
|
72352
|
-
type: 'string'
|
72353
|
-
}
|
72354
|
-
}));
|
72355
|
-
})
|
72356
|
-
]
|
72357
|
-
})
|
72358
|
-
})))
|
72359
|
-
}));
|
72397
|
+
];
|
72360
72398
|
return list;
|
72361
72399
|
}
|
72362
72400
|
async loadScene(reasoning) {
|
package/index.esm2.js
CHANGED
@@ -2112,6 +2112,14 @@ function generateSceneBlock(pinsSettings, workspace) {
|
|
2112
2112
|
if (parameter) {
|
2113
2113
|
if (parameter.schema.type === 'array' && parameter.schema.items.$ref) {
|
2114
2114
|
const parameterType = getParameterType(parameter.schema.items);
|
2115
|
+
if (typeof metadataValue === 'string') {
|
2116
|
+
const metadataBlock = generateParameterBlock({
|
2117
|
+
type: 'string'
|
2118
|
+
}, metadataValue, workspace, foundLibrary);
|
2119
|
+
const sceneInputConnection = sceneBlock.getInput(inputName + '__EVALUATE').connection;
|
2120
|
+
connectBlock(metadataBlock, sceneInputConnection);
|
2121
|
+
continue;
|
2122
|
+
}
|
2115
2123
|
for (const componentSettings of metadataValue.reverse()){
|
2116
2124
|
const componentBlock = parameterType === 'component' ? generateBlockFromComponent(componentSettings, workspace, foundLibrary, parameter.schema.items.$ref) : generateBlockFromPins(componentSettings, workspace);
|
2117
2125
|
const sceneInputConnection = sceneBlock.getInput(inputName).connection;
|
@@ -2139,6 +2147,14 @@ function generateSceneBlock(pinsSettings, workspace) {
|
|
2139
2147
|
if (parameter) {
|
2140
2148
|
if (parameter.schema.type === 'array' && parameter.schema.items.$ref) {
|
2141
2149
|
const parameterType = getParameterType(parameter.schema.items);
|
2150
|
+
if (typeof value === 'string') {
|
2151
|
+
const metadataBlock = generateParameterBlock({
|
2152
|
+
type: 'string'
|
2153
|
+
}, value, workspace, foundLibrary);
|
2154
|
+
const sceneInputConnection = sceneBlock.getInput(inputName + '__EVALUATE').connection;
|
2155
|
+
connectBlock(metadataBlock, sceneInputConnection);
|
2156
|
+
continue;
|
2157
|
+
}
|
2142
2158
|
for (const componentSettings of value.reverse()){
|
2143
2159
|
const componentBlock = parameterType === 'component' ? generateBlockFromComponent(componentSettings, workspace, foundLibrary, parameter.schema.items.$ref) : generateBlockFromPins(componentSettings, workspace);
|
2144
2160
|
const sceneInputConnection = sceneBlock.getInput(inputName).connection;
|
@@ -2226,7 +2242,9 @@ function generateBlockFromPins(pinsSettings, workspace) {
|
|
2226
2242
|
if (parameter.schema.type === 'array' && parameter.schema.items.$ref) {
|
2227
2243
|
const parameterType = getParameterType(parameter.schema.items);
|
2228
2244
|
if (typeof valueToLoad === 'string') {
|
2229
|
-
const parameterBlock = generateParameterBlock(
|
2245
|
+
const parameterBlock = generateParameterBlock({
|
2246
|
+
type: 'string'
|
2247
|
+
}, valueToLoad, workspace, library);
|
2230
2248
|
const inputConnection = pinsBlock.getInput(parameter.name + '__EVALUATE').connection;
|
2231
2249
|
connectBlock(parameterBlock, inputConnection);
|
2232
2250
|
continue;
|
@@ -2271,13 +2289,31 @@ function generateBlockFromPins(pinsSettings, workspace) {
|
|
2271
2289
|
}
|
2272
2290
|
];
|
2273
2291
|
for (const parameter of conditions){
|
2292
|
+
var _parameter_schema_items;
|
2274
2293
|
if (!pinsSettings.conditions || !Object.prototype.hasOwnProperty.call(pinsSettings.conditions, parameter.name)) {
|
2275
2294
|
continue;
|
2276
2295
|
}
|
2277
2296
|
const valueToLoad = pinsSettings.conditions[parameter.name];
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2297
|
+
if (parameter.schema.type === 'array' && ((_parameter_schema_items = parameter.schema.items) == null ? void 0 : _parameter_schema_items.$ref)) {
|
2298
|
+
const parameterType = getParameterType(parameter.schema.items);
|
2299
|
+
if (typeof valueToLoad === 'string') {
|
2300
|
+
const parameterBlock = generateParameterBlock({
|
2301
|
+
type: 'string'
|
2302
|
+
}, valueToLoad, workspace, library);
|
2303
|
+
const inputConnection = pinsBlock.getInput('__CONDITION__/' + parameter.name + '__EVALUATE').connection;
|
2304
|
+
connectBlock(parameterBlock, inputConnection);
|
2305
|
+
continue;
|
2306
|
+
}
|
2307
|
+
for (const propertyValue of valueToLoad.reverse()){
|
2308
|
+
const parameterBlock = parameterType === 'component' ? generateBlockFromComponent(propertyValue, workspace, library, parameter.schema.items.$ref) : generateBlockFromPins(propertyValue, workspace);
|
2309
|
+
const inputConnection = pinsBlock.getInput('__CONDITION__/' + parameter.name).connection;
|
2310
|
+
connectBlock(parameterBlock, inputConnection);
|
2311
|
+
}
|
2312
|
+
} else {
|
2313
|
+
const parameterBlock = generateParameterBlock(parameter.schema, valueToLoad, workspace, library);
|
2314
|
+
const inputConnection = pinsBlock.getInput('__CONDITION__/' + parameter.name).connection;
|
2315
|
+
connectBlock(parameterBlock, inputConnection);
|
2316
|
+
}
|
2281
2317
|
}
|
2282
2318
|
return pinsBlock;
|
2283
2319
|
}
|
@@ -2305,15 +2341,23 @@ function generateBlockFromComponent(componentSettings, workspace, library, compo
|
|
2305
2341
|
const valueToLoad = componentSettings[propertyKey];
|
2306
2342
|
if (schema.type === 'array' && schema.items.$ref) {
|
2307
2343
|
const parameterType = getParameterType(schema.items);
|
2344
|
+
if (typeof valueToLoad === 'string') {
|
2345
|
+
const parameterBlock = generateParameterBlock({
|
2346
|
+
type: 'string'
|
2347
|
+
}, valueToLoad, workspace, library);
|
2348
|
+
const componentInputConnection = componentBlock.getInput(propertyKey + '__EVALUATE').connection;
|
2349
|
+
connectBlock(parameterBlock, componentInputConnection);
|
2350
|
+
continue;
|
2351
|
+
}
|
2308
2352
|
for (const propertyValue of valueToLoad.reverse()){
|
2309
2353
|
const parameterBlock = parameterType === 'component' ? generateBlockFromComponent(propertyValue, workspace, library, schema.items.$ref) : generateBlockFromPins(propertyValue, workspace);
|
2310
|
-
const
|
2311
|
-
connectBlock(parameterBlock,
|
2354
|
+
const componentInputConnection = componentBlock.getInput(propertyKey).connection;
|
2355
|
+
connectBlock(parameterBlock, componentInputConnection);
|
2312
2356
|
}
|
2313
2357
|
} else {
|
2314
2358
|
const parameterBlock = generateParameterBlock(schema, valueToLoad, workspace, library);
|
2315
|
-
const
|
2316
|
-
connectBlock(parameterBlock,
|
2359
|
+
const componentInputConnection = componentBlock.getInput(propertyKey).connection;
|
2360
|
+
connectBlock(parameterBlock, componentInputConnection);
|
2317
2361
|
}
|
2318
2362
|
}
|
2319
2363
|
componentBlock.render();
|
@@ -2489,12 +2533,16 @@ function itemListFromPinsSettings(pinsSettings, pinsDefinition) {
|
|
2489
2533
|
}
|
2490
2534
|
if (pinsDefinition.parameters && pinsSettings.properties) {
|
2491
2535
|
for (const parameter of pinsDefinition.parameters){
|
2536
|
+
var _parameter_schema, _parameter_schema_items, _parameter_schema_items_$ref, _parameter_schema_items1;
|
2492
2537
|
if (!Object.prototype.hasOwnProperty.call(pinsSettings.properties, parameter.name)) {
|
2493
2538
|
continue;
|
2494
2539
|
}
|
2540
|
+
const isEvaluate = ((_parameter_schema = parameter.schema) == null ? void 0 : _parameter_schema.type) === 'array' && typeof pinsSettings.properties[parameter.name] === 'string' && (((_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/')));
|
2541
|
+
const name = isEvaluate ? parameter.name + '__EVALUATE' : parameter.name;
|
2542
|
+
const summary = isEvaluate ? (parameter.summary || parameter.name) + ' (evaluate)' : parameter.summary || parameter.name;
|
2495
2543
|
inputArray.push({
|
2496
|
-
id:
|
2497
|
-
name:
|
2544
|
+
id: name,
|
2545
|
+
name: summary
|
2498
2546
|
});
|
2499
2547
|
}
|
2500
2548
|
}
|
@@ -2534,12 +2582,16 @@ function itemListFromPinsSettings(pinsSettings, pinsDefinition) {
|
|
2534
2582
|
function itemListFromComponentSettings(componentSettings, componentDefinition) {
|
2535
2583
|
const inputArray = [];
|
2536
2584
|
for (const [propertyKey, propertyValue] of Object.entries(componentDefinition.properties)){
|
2585
|
+
var _propertyValue_items, _propertyValue_items_$ref, _propertyValue_items1;
|
2537
2586
|
if (!Object.prototype.hasOwnProperty.call(componentSettings, propertyKey) || propertyValue.type === 'array' && (!componentSettings[propertyKey] || componentSettings[propertyKey].length === 0)) {
|
2538
2587
|
continue;
|
2539
2588
|
}
|
2589
|
+
const isEvaluate = propertyValue.type === 'array' && typeof componentSettings[propertyKey] === 'string' && (((_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/')));
|
2590
|
+
const name = isEvaluate ? propertyKey + '__EVALUATE' : propertyKey;
|
2591
|
+
const summary = isEvaluate ? (propertyValue.summary || propertyKey) + ' (evaluate)' : propertyValue.summary || propertyKey;
|
2540
2592
|
inputArray.push({
|
2541
|
-
id:
|
2542
|
-
name:
|
2593
|
+
id: name,
|
2594
|
+
name: summary
|
2543
2595
|
});
|
2544
2596
|
}
|
2545
2597
|
return inputArray;
|
@@ -2548,12 +2600,16 @@ function itemListFromSceneSettings(sceneSettings, sceneDefinition) {
|
|
2548
2600
|
const inputArray = [];
|
2549
2601
|
if (sceneDefinition.parameters && sceneSettings.properties) {
|
2550
2602
|
for (const parameter of sceneDefinition.parameters){
|
2603
|
+
var _parameter_schema, _parameter_schema_items, _parameter_schema_items_$ref, _parameter_schema_items1;
|
2551
2604
|
if (!Object.prototype.hasOwnProperty.call(sceneSettings.properties, parameter.name)) {
|
2552
2605
|
continue;
|
2553
2606
|
}
|
2607
|
+
const isEvaluate = ((_parameter_schema = parameter.schema) == null ? void 0 : _parameter_schema.type) === 'array' && typeof sceneSettings.properties[parameter.name] === 'string' && (((_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/')));
|
2608
|
+
const name = isEvaluate ? parameter.name + '__EVALUATE' : parameter.name;
|
2609
|
+
const summary = isEvaluate ? (parameter.summary || parameter.name) + ' (evaluate)' : parameter.summary || parameter.name;
|
2554
2610
|
inputArray.push({
|
2555
|
-
id:
|
2556
|
-
name:
|
2611
|
+
id: name,
|
2612
|
+
name: summary
|
2557
2613
|
});
|
2558
2614
|
}
|
2559
2615
|
}
|
@@ -72336,25 +72392,7 @@ class EditorElement extends r$1 {
|
|
72336
72392
|
const list = [
|
72337
72393
|
this.language === 'fr' ? schemas : schemas$1,
|
72338
72394
|
...this.schemas
|
72339
|
-
]
|
72340
|
-
paths: _extends({}, schema.paths.map((path)=>_extends({}, path, {
|
72341
|
-
post: _extends({}, path.post, {
|
72342
|
-
parameters: [
|
72343
|
-
...path.post.parameters,
|
72344
|
-
...path.post.parameters.filter((item)=>{
|
72345
|
-
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
72346
|
-
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) === '#/components/schemas/Block' || ((_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/'))).map((item)=>_extends({}, item, {
|
72347
|
-
name: item.name + '__EVALUATE',
|
72348
|
-
summary: item.summary + ' (evaluate)',
|
72349
|
-
schema: {
|
72350
|
-
type: 'string'
|
72351
|
-
}
|
72352
|
-
}));
|
72353
|
-
})
|
72354
|
-
]
|
72355
|
-
})
|
72356
|
-
})))
|
72357
|
-
}));
|
72395
|
+
];
|
72358
72396
|
return list;
|
72359
72397
|
}
|
72360
72398
|
async loadScene(reasoning) {
|
package/package.json
CHANGED
package/pins-to-blockly.cjs.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
+
var index = require('./index.cjs2.js');
|
4
|
+
|
3
5
|
function getPinsBlockDefinition(library, methodData, pinsId) {
|
4
6
|
const blockDefinition = {
|
5
7
|
type: pinsId,
|
@@ -252,11 +254,82 @@ function generateToolboxFromLibraries(libraries, tags) {
|
|
252
254
|
};
|
253
255
|
return toolbox;
|
254
256
|
}
|
257
|
+
function convertPinsLibrariesToBlocklyLibraries(pinsLibraries) {
|
258
|
+
return pinsLibraries.map((schema)=>index._extends({}, schema, {
|
259
|
+
paths: index._extends({}, Object.entries(schema.paths).reduce((acc, [key, path])=>index._extends({}, acc, {
|
260
|
+
[key]: index._extends({}, path, {
|
261
|
+
post: index._extends({}, path.post, {
|
262
|
+
parameters: [
|
263
|
+
...path.post.parameters,
|
264
|
+
...path.post.parameters.filter((item)=>{
|
265
|
+
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
266
|
+
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/')));
|
267
|
+
}).map((item)=>index._extends({}, item, {
|
268
|
+
name: item.name + '__EVALUATE',
|
269
|
+
summary: item.summary + ' (evaluate)',
|
270
|
+
required: false,
|
271
|
+
schema: {
|
272
|
+
type: 'string'
|
273
|
+
}
|
274
|
+
}))
|
275
|
+
]
|
276
|
+
})
|
277
|
+
})
|
278
|
+
}), {})),
|
279
|
+
components: index._extends({}, schema.components, {
|
280
|
+
schemas: index._extends({}, Object.entries(schema.components.schemas).reduce((acc, [key, component])=>index._extends({}, acc, {
|
281
|
+
[key]: index._extends({}, component, {
|
282
|
+
properties: index._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])=>index._extends({}, acc, {
|
286
|
+
[propertyKey + '__EVALUATE']: index._extends({}, property, {
|
287
|
+
required: false
|
288
|
+
})
|
289
|
+
}), {}))
|
290
|
+
})
|
291
|
+
}), {}))
|
292
|
+
}),
|
293
|
+
'x-scene-blocks': index._extends({}, Object.entries(schema.paths).reduce((acc, [key, path])=>index._extends({}, acc, {
|
294
|
+
[key]: index._extends({}, path, {
|
295
|
+
metadata: [
|
296
|
+
...path.metadata,
|
297
|
+
...path.metadata.filter((item)=>{
|
298
|
+
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
299
|
+
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/')));
|
300
|
+
}).map((item)=>index._extends({}, item, {
|
301
|
+
name: item.name + '__EVALUATE',
|
302
|
+
summary: item.summary + ' (evaluate)',
|
303
|
+
required: false,
|
304
|
+
schema: {
|
305
|
+
type: 'string'
|
306
|
+
}
|
307
|
+
}))
|
308
|
+
],
|
309
|
+
parameters: [
|
310
|
+
...path.parameters,
|
311
|
+
...path.parameters.filter((item)=>{
|
312
|
+
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
313
|
+
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/')));
|
314
|
+
}).map((item)=>index._extends({}, item, {
|
315
|
+
name: item.name + '__EVALUATE',
|
316
|
+
summary: item.summary + ' (evaluate)',
|
317
|
+
required: false,
|
318
|
+
schema: {
|
319
|
+
type: 'string'
|
320
|
+
}
|
321
|
+
}))
|
322
|
+
]
|
323
|
+
})
|
324
|
+
}), {}))
|
325
|
+
}));
|
326
|
+
}
|
255
327
|
function generateBlocklyBlockFromLibraries(pinsLibraries, blocksLegacy) {
|
256
328
|
const blocksLibrary = [
|
257
329
|
...blocksLegacy
|
258
330
|
];
|
259
|
-
|
331
|
+
const blocklyLibraries = convertPinsLibrariesToBlocklyLibraries(pinsLibraries);
|
332
|
+
for (const pinsLibrary of blocklyLibraries){
|
260
333
|
//search for pins blocks
|
261
334
|
for(const endpoint in pinsLibrary.paths){
|
262
335
|
if (Object.hasOwnProperty.call(pinsLibrary.paths, endpoint)) {
|
@@ -267,7 +340,7 @@ function generateBlocklyBlockFromLibraries(pinsLibraries, blocksLegacy) {
|
|
267
340
|
}
|
268
341
|
}
|
269
342
|
}
|
270
|
-
for (const pinsLibrary of
|
343
|
+
for (const pinsLibrary of blocklyLibraries){
|
271
344
|
//search for components blocks
|
272
345
|
if (!pinsLibrary.components || !pinsLibrary.components.schemas) {
|
273
346
|
continue;
|
@@ -284,7 +357,7 @@ function generateBlocklyBlockFromLibraries(pinsLibraries, blocksLegacy) {
|
|
284
357
|
}
|
285
358
|
}
|
286
359
|
}
|
287
|
-
for (const pinsLibrary of
|
360
|
+
for (const pinsLibrary of blocklyLibraries){
|
288
361
|
//search for scene blocks
|
289
362
|
for(const endpoint in pinsLibrary['x-scene-blocks']){
|
290
363
|
if (Object.hasOwnProperty.call(pinsLibrary['x-scene-blocks'], endpoint)) {
|
package/pins-to-blockly.esm.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import { _ as _extends } from './index.esm2.js';
|
2
|
+
|
1
3
|
function getPinsBlockDefinition(library, methodData, pinsId) {
|
2
4
|
const blockDefinition = {
|
3
5
|
type: pinsId,
|
@@ -250,11 +252,82 @@ function generateToolboxFromLibraries(libraries, tags) {
|
|
250
252
|
};
|
251
253
|
return toolbox;
|
252
254
|
}
|
255
|
+
function convertPinsLibrariesToBlocklyLibraries(pinsLibraries) {
|
256
|
+
return pinsLibraries.map((schema)=>_extends({}, schema, {
|
257
|
+
paths: _extends({}, Object.entries(schema.paths).reduce((acc, [key, path])=>_extends({}, acc, {
|
258
|
+
[key]: _extends({}, path, {
|
259
|
+
post: _extends({}, path.post, {
|
260
|
+
parameters: [
|
261
|
+
...path.post.parameters,
|
262
|
+
...path.post.parameters.filter((item)=>{
|
263
|
+
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
264
|
+
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/')));
|
265
|
+
}).map((item)=>_extends({}, item, {
|
266
|
+
name: item.name + '__EVALUATE',
|
267
|
+
summary: item.summary + ' (evaluate)',
|
268
|
+
required: false,
|
269
|
+
schema: {
|
270
|
+
type: 'string'
|
271
|
+
}
|
272
|
+
}))
|
273
|
+
]
|
274
|
+
})
|
275
|
+
})
|
276
|
+
}), {})),
|
277
|
+
components: _extends({}, schema.components, {
|
278
|
+
schemas: _extends({}, Object.entries(schema.components.schemas).reduce((acc, [key, component])=>_extends({}, acc, {
|
279
|
+
[key]: _extends({}, component, {
|
280
|
+
properties: _extends({}, component.properties, Object.entries(component.properties).filter(([_propertyKey, propertyValue])=>{
|
281
|
+
var _propertyValue_items, _propertyValue_items_$ref, _propertyValue_items1;
|
282
|
+
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/')));
|
283
|
+
}).reduce((acc, [propertyKey, property])=>_extends({}, acc, {
|
284
|
+
[propertyKey + '__EVALUATE']: _extends({}, property, {
|
285
|
+
required: false
|
286
|
+
})
|
287
|
+
}), {}))
|
288
|
+
})
|
289
|
+
}), {}))
|
290
|
+
}),
|
291
|
+
'x-scene-blocks': _extends({}, Object.entries(schema.paths).reduce((acc, [key, path])=>_extends({}, acc, {
|
292
|
+
[key]: _extends({}, path, {
|
293
|
+
metadata: [
|
294
|
+
...path.metadata,
|
295
|
+
...path.metadata.filter((item)=>{
|
296
|
+
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
297
|
+
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/')));
|
298
|
+
}).map((item)=>_extends({}, item, {
|
299
|
+
name: item.name + '__EVALUATE',
|
300
|
+
summary: item.summary + ' (evaluate)',
|
301
|
+
required: false,
|
302
|
+
schema: {
|
303
|
+
type: 'string'
|
304
|
+
}
|
305
|
+
}))
|
306
|
+
],
|
307
|
+
parameters: [
|
308
|
+
...path.parameters,
|
309
|
+
...path.parameters.filter((item)=>{
|
310
|
+
var _item_schema, _item_schema_items, _item_schema_items_$ref, _item_schema_items1;
|
311
|
+
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/')));
|
312
|
+
}).map((item)=>_extends({}, item, {
|
313
|
+
name: item.name + '__EVALUATE',
|
314
|
+
summary: item.summary + ' (evaluate)',
|
315
|
+
required: false,
|
316
|
+
schema: {
|
317
|
+
type: 'string'
|
318
|
+
}
|
319
|
+
}))
|
320
|
+
]
|
321
|
+
})
|
322
|
+
}), {}))
|
323
|
+
}));
|
324
|
+
}
|
253
325
|
function generateBlocklyBlockFromLibraries(pinsLibraries, blocksLegacy) {
|
254
326
|
const blocksLibrary = [
|
255
327
|
...blocksLegacy
|
256
328
|
];
|
257
|
-
|
329
|
+
const blocklyLibraries = convertPinsLibrariesToBlocklyLibraries(pinsLibraries);
|
330
|
+
for (const pinsLibrary of blocklyLibraries){
|
258
331
|
//search for pins blocks
|
259
332
|
for(const endpoint in pinsLibrary.paths){
|
260
333
|
if (Object.hasOwnProperty.call(pinsLibrary.paths, endpoint)) {
|
@@ -265,7 +338,7 @@ function generateBlocklyBlockFromLibraries(pinsLibraries, blocksLegacy) {
|
|
265
338
|
}
|
266
339
|
}
|
267
340
|
}
|
268
|
-
for (const pinsLibrary of
|
341
|
+
for (const pinsLibrary of blocklyLibraries){
|
269
342
|
//search for components blocks
|
270
343
|
if (!pinsLibrary.components || !pinsLibrary.components.schemas) {
|
271
344
|
continue;
|
@@ -282,7 +355,7 @@ function generateBlocklyBlockFromLibraries(pinsLibraries, blocksLegacy) {
|
|
282
355
|
}
|
283
356
|
}
|
284
357
|
}
|
285
|
-
for (const pinsLibrary of
|
358
|
+
for (const pinsLibrary of blocklyLibraries){
|
286
359
|
//search for scene blocks
|
287
360
|
for(const endpoint in pinsLibrary['x-scene-blocks']){
|
288
361
|
if (Object.hasOwnProperty.call(pinsLibrary['x-scene-blocks'], endpoint)) {
|