@fugood/bricks-project 2.21.0-beta.14.test2 → 2.21.0-beta.14.test3
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/api/index.ts +1 -1
- package/api/{application.ts → instance.ts} +40 -0
- package/compile/index.ts +107 -14
- package/package.json +1 -1
- package/types/common.ts +4 -1
- package/types/data-calc.ts +32 -0
- package/types/data.ts +43 -3
- package/types/subspace.ts +17 -2
package/api/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './instance'
|
|
@@ -48,6 +48,30 @@ export const deployApp = async (appId: string, config: {}, lastCommitId: string)
|
|
|
48
48
|
return true
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
export const deployModule = async (modId: string, config: {}, lastCommitId: string) => {
|
|
52
|
+
const { errors } = await doGQL(
|
|
53
|
+
`mutation BRICKS_PROJECT_updateModule($id: ID!, $config: JSON) {
|
|
54
|
+
updateModule(
|
|
55
|
+
id: $id
|
|
56
|
+
config: $config
|
|
57
|
+
validateConfig: true
|
|
58
|
+
) {
|
|
59
|
+
_id
|
|
60
|
+
name
|
|
61
|
+
}
|
|
62
|
+
}`,
|
|
63
|
+
{
|
|
64
|
+
id: modId,
|
|
65
|
+
config: {
|
|
66
|
+
...config,
|
|
67
|
+
bricks_project_last_commit_id: lastCommitId,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
)
|
|
71
|
+
if (errors) throw new Error(errors[0].message)
|
|
72
|
+
return true
|
|
73
|
+
}
|
|
74
|
+
|
|
51
75
|
export const pullApp = async (appId: string) => {
|
|
52
76
|
const { data, errors } = await doGQL(
|
|
53
77
|
`query BRICKS_PROJECT_application($id: ID!) {
|
|
@@ -63,3 +87,19 @@ export const pullApp = async (appId: string) => {
|
|
|
63
87
|
if (errors) throw new Error(errors[0].message)
|
|
64
88
|
return data.application
|
|
65
89
|
}
|
|
90
|
+
|
|
91
|
+
export const pullModule = async (modId: string) => {
|
|
92
|
+
const { data, errors } = await doGQL(
|
|
93
|
+
`query BRICKS_PROJECT_module($id: ID!) {
|
|
94
|
+
module(id: $id) {
|
|
95
|
+
_id
|
|
96
|
+
name
|
|
97
|
+
description
|
|
98
|
+
config
|
|
99
|
+
}
|
|
100
|
+
}`,
|
|
101
|
+
{ id: modId },
|
|
102
|
+
)
|
|
103
|
+
if (errors) throw new Error(errors[0].message)
|
|
104
|
+
return data.module
|
|
105
|
+
}
|
package/compile/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
Brick,
|
|
21
21
|
Generator,
|
|
22
22
|
Canvas,
|
|
23
|
+
Subspace,
|
|
23
24
|
} from '../types'
|
|
24
25
|
import { generateCalulationMap } from './util'
|
|
25
26
|
|
|
@@ -184,6 +185,47 @@ const compileFrame = (frame: Canvas['items'][number]['frame']) => ({
|
|
|
184
185
|
render_out_of_viewport: frame.renderOutOfViewport,
|
|
185
186
|
})
|
|
186
187
|
|
|
188
|
+
const compileKind = (kind: Data['kind']) => {
|
|
189
|
+
const { type, ...rest } = kind || {}
|
|
190
|
+
if (!type) return {}
|
|
191
|
+
return { kind: type, ...rest }
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const compileRemoteUpdate = (remoteUpdate: Data['remoteUpdate']) => {
|
|
195
|
+
if (!remoteUpdate) return {}
|
|
196
|
+
if (remoteUpdate.type === 'auto') return { enable_remote_update: true }
|
|
197
|
+
return {
|
|
198
|
+
enable_remote_update: true,
|
|
199
|
+
...(remoteUpdate.type === 'device-specific' ? { use_remote_id_prefix: true } : {}),
|
|
200
|
+
...(remoteUpdate.type === 'global-data' ? { global_remote_update_prop: remoteUpdate.id } : {}),
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const compileModule = (subspace: Subspace) => {
|
|
205
|
+
if (!subspace.module) return {}
|
|
206
|
+
return {
|
|
207
|
+
module: {
|
|
208
|
+
link: true,
|
|
209
|
+
id: subspace.module.id,
|
|
210
|
+
version: subspace.module.version,
|
|
211
|
+
},
|
|
212
|
+
selected_requirements: subspace.module.selectedRequirements?.reduce((acc, requirement) => {
|
|
213
|
+
acc[requirement.subspace] = {
|
|
214
|
+
id: requirement.id,
|
|
215
|
+
version: requirement.version,
|
|
216
|
+
}
|
|
217
|
+
return acc
|
|
218
|
+
}, {}),
|
|
219
|
+
requirements: subspace.module.requirements?.reduce((acc, requirement) => {
|
|
220
|
+
acc[requirement.subspace] = {
|
|
221
|
+
id: requirement.id,
|
|
222
|
+
version: requirement.version,
|
|
223
|
+
}
|
|
224
|
+
return acc
|
|
225
|
+
}, {}),
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
187
229
|
export const compile = (app: Application) => {
|
|
188
230
|
const config = {
|
|
189
231
|
title: app.name,
|
|
@@ -196,6 +238,11 @@ export const compile = (app: Application) => {
|
|
|
196
238
|
height: subspace.layout?.height,
|
|
197
239
|
resize_mode: subspace.layout?.resizeMode,
|
|
198
240
|
},
|
|
241
|
+
local_sync: subspace.localSyncChangeCanvas
|
|
242
|
+
? {
|
|
243
|
+
change_canvas: subspace.localSyncChangeCanvas,
|
|
244
|
+
}
|
|
245
|
+
: undefined,
|
|
199
246
|
animation_map: subspace.animations.reduce((map, animation) => {
|
|
200
247
|
if (animation.__typename === 'Animation') {
|
|
201
248
|
const animationDef = animation as AnimationDef
|
|
@@ -324,6 +371,11 @@ export const compile = (app: Application) => {
|
|
|
324
371
|
template_key: generator.templateKey,
|
|
325
372
|
title: generator.title,
|
|
326
373
|
description: generator.description,
|
|
374
|
+
local_sync: generator.localSyncRunMode
|
|
375
|
+
? {
|
|
376
|
+
run_mode: generator.localSyncRunMode,
|
|
377
|
+
}
|
|
378
|
+
: undefined,
|
|
327
379
|
property: compileProperty(generator.property || {}),
|
|
328
380
|
event_map: compileEvents(generator.templateKey, generator.events || {}),
|
|
329
381
|
outlet: compileOutlets(generator.templateKey, generator.outlets || {}),
|
|
@@ -349,10 +401,19 @@ export const compile = (app: Application) => {
|
|
|
349
401
|
map[data.id] = {
|
|
350
402
|
title: data.title,
|
|
351
403
|
description: data.description,
|
|
404
|
+
linked: data.metadata?.linked,
|
|
405
|
+
linkedFrom: data.metadata?.linkedFrom,
|
|
406
|
+
local_sync: data.localSyncUpdateMode
|
|
407
|
+
? {
|
|
408
|
+
update_mode: data.localSyncUpdateMode,
|
|
409
|
+
}
|
|
410
|
+
: undefined,
|
|
352
411
|
persist_data: data.persistData,
|
|
412
|
+
...compileRemoteUpdate(data.remoteUpdate),
|
|
353
413
|
routing: data.routing,
|
|
354
414
|
schema: data.schema,
|
|
355
415
|
type: data.type,
|
|
416
|
+
...compileKind(data.kind),
|
|
356
417
|
value: data.value,
|
|
357
418
|
event_map: compileEvents('PROPERTY_BANK', data.events || {}),
|
|
358
419
|
}
|
|
@@ -369,14 +430,27 @@ export const compile = (app: Application) => {
|
|
|
369
430
|
|
|
370
431
|
const generateInputPorts = (inputs, outputs) =>
|
|
371
432
|
inputs.reduce((acc, port) => {
|
|
372
|
-
if (!port.
|
|
433
|
+
if (!acc[port.key]) acc[port.key] = null
|
|
373
434
|
|
|
374
|
-
|
|
375
|
-
let
|
|
435
|
+
let sourceId
|
|
436
|
+
let sourceNode = port.source()
|
|
437
|
+
if (sourceNode?.__typename === 'DataCalculationData')
|
|
438
|
+
sourceId = (sourceNode as DataCalculationData).data().id
|
|
439
|
+
if (sourceNode?.__typename === 'DataCommand') sourceId = sourceNode.id
|
|
376
440
|
|
|
441
|
+
if (!sourceId) return acc
|
|
377
442
|
if (!acc[port.key]) acc[port.key] = []
|
|
443
|
+
|
|
444
|
+
const firstOutput = outputs[0]
|
|
445
|
+
let disableTriggerCommandIn
|
|
446
|
+
let firstOutputTargetNode = firstOutput?.target()
|
|
447
|
+
if (!port.trigger && firstOutputTargetNode?.__typename === 'DataCalculationData')
|
|
448
|
+
disableTriggerCommandIn = (firstOutputTargetNode as DataCalculationData).data().id
|
|
449
|
+
if (!port.trigger && firstOutputTargetNode?.__typename === 'DataCommand')
|
|
450
|
+
disableTriggerCommandIn = firstOutputTargetNode.id
|
|
451
|
+
|
|
378
452
|
acc[port.key].push({
|
|
379
|
-
id:
|
|
453
|
+
id: sourceId,
|
|
380
454
|
port: port.sourceKey,
|
|
381
455
|
disable_trigger_command_in: disableTriggerCommandIn,
|
|
382
456
|
})
|
|
@@ -385,18 +459,26 @@ export const compile = (app: Application) => {
|
|
|
385
459
|
|
|
386
460
|
const generateOutputPorts = (outputs) =>
|
|
387
461
|
outputs.reduce((acc, port) => {
|
|
388
|
-
if (!port.
|
|
462
|
+
if (!acc[port.key]) acc[port.key] = null
|
|
389
463
|
|
|
464
|
+
let targetId
|
|
465
|
+
let targetNode = port.target()
|
|
466
|
+
if (targetNode?.__typename === 'DataCalculationData')
|
|
467
|
+
targetId = (targetNode as DataCalculationData).data().id
|
|
468
|
+
if (targetNode?.__typename === 'DataCommand') targetId = targetNode.id
|
|
469
|
+
|
|
470
|
+
if (!targetId) return acc
|
|
390
471
|
if (!acc[port.key]) acc[port.key] = []
|
|
472
|
+
|
|
391
473
|
acc[port.key].push({
|
|
392
|
-
id:
|
|
474
|
+
id: targetId,
|
|
393
475
|
port: port.targetKey,
|
|
394
476
|
})
|
|
395
477
|
return acc
|
|
396
478
|
}, {})
|
|
397
479
|
|
|
398
480
|
const getNodeId = (node) => {
|
|
399
|
-
if (node.__typename === 'DataCalculationData') return node.data.id
|
|
481
|
+
if (node.__typename === 'DataCalculationData') return node.data().id
|
|
400
482
|
if (node.__typename === 'DataCommand') return node.id
|
|
401
483
|
throw new Error(`Invalid node: ${JSON.stringify(node)}`)
|
|
402
484
|
}
|
|
@@ -463,15 +545,20 @@ export const compile = (app: Application) => {
|
|
|
463
545
|
const scriptCalc = dataCalc as DataCalculationScript
|
|
464
546
|
calc.type = 'script'
|
|
465
547
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
548
|
+
let code: string
|
|
549
|
+
try {
|
|
550
|
+
const program = parseAST(scriptCalc.code, { sourceType: 'module', ecmaVersion: 2020 })
|
|
551
|
+
// export function main() { ... }
|
|
552
|
+
const declarationBody = (
|
|
553
|
+
(program.body[0] as ExportNamedDeclaration).declaration as FunctionDeclaration
|
|
554
|
+
)?.body
|
|
555
|
+
code = escodegen.generate(declarationBody)
|
|
556
|
+
} catch (e) {
|
|
557
|
+
code = scriptCalc.code || ''
|
|
558
|
+
}
|
|
472
559
|
calc.script_config = {
|
|
473
560
|
note: scriptCalc.note,
|
|
474
|
-
code
|
|
561
|
+
code,
|
|
475
562
|
enable_async: scriptCalc.enableAsync,
|
|
476
563
|
inputs: scriptCalc.inputs.reduce((acc, input) => {
|
|
477
564
|
acc[input.data().id] = input.key
|
|
@@ -502,12 +589,18 @@ export const compile = (app: Application) => {
|
|
|
502
589
|
}, {}),
|
|
503
590
|
action_map: subspace.actions || {},
|
|
504
591
|
event_map: compileEvents('', subspace.events || {}),
|
|
592
|
+
routing: subspace.dataRouting.reduce((acc, data) => {
|
|
593
|
+
acc[data.id] = { enabled_routing: true }
|
|
594
|
+
return acc
|
|
595
|
+
}, {}),
|
|
596
|
+
...compileModule(subspace),
|
|
505
597
|
}
|
|
506
598
|
return subspaceMap
|
|
507
599
|
}, {}),
|
|
508
600
|
root_subspace_id: app.rootSubspace.id,
|
|
509
601
|
fonts: app.fonts,
|
|
510
602
|
...compileApplicationSettings(app.settings),
|
|
603
|
+
test_map: app.metadata?.TEMP_test_map || {},
|
|
511
604
|
}
|
|
512
605
|
return config
|
|
513
606
|
}
|
package/package.json
CHANGED
package/types/common.ts
CHANGED
package/types/data-calc.ts
CHANGED
|
@@ -950,6 +950,7 @@ export type DataCommandObjectMapKeys = DataCommand & {
|
|
|
950
950
|
}
|
|
951
951
|
| {
|
|
952
952
|
// Default value: undefined
|
|
953
|
+
// Iteratee Callback Input: true
|
|
953
954
|
key: 'iteratee_result_key'
|
|
954
955
|
source: (() => DataCalculationData | DataCommand) | any
|
|
955
956
|
sourceKey: string
|
|
@@ -958,6 +959,7 @@ export type DataCommandObjectMapKeys = DataCommand & {
|
|
|
958
959
|
>
|
|
959
960
|
outputs?: Array<
|
|
960
961
|
| {
|
|
962
|
+
// Iteratee Callback: true
|
|
961
963
|
key: 'iteratee_input'
|
|
962
964
|
// target type: object
|
|
963
965
|
target: () => DataCalculationData | DataCommand
|
|
@@ -997,6 +999,7 @@ export type DataCommandObjectMapValues = DataCommand & {
|
|
|
997
999
|
}
|
|
998
1000
|
| {
|
|
999
1001
|
// Default value: undefined
|
|
1002
|
+
// Iteratee Callback Input: true
|
|
1000
1003
|
key: 'iteratee_result_key'
|
|
1001
1004
|
source: (() => DataCalculationData | DataCommand) | any
|
|
1002
1005
|
sourceKey: string
|
|
@@ -1005,6 +1008,7 @@ export type DataCommandObjectMapValues = DataCommand & {
|
|
|
1005
1008
|
>
|
|
1006
1009
|
outputs?: Array<
|
|
1007
1010
|
| {
|
|
1011
|
+
// Iteratee Callback: true
|
|
1008
1012
|
key: 'iteratee_input'
|
|
1009
1013
|
// target type: object
|
|
1010
1014
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1220,6 +1224,7 @@ export type DataCommandCollectionCount = DataCommand & {
|
|
|
1220
1224
|
}
|
|
1221
1225
|
| {
|
|
1222
1226
|
// Default value: undefined
|
|
1227
|
+
// Iteratee Callback Input: true
|
|
1223
1228
|
key: 'iteratee_result_group'
|
|
1224
1229
|
source: (() => DataCalculationData | DataCommand) | string
|
|
1225
1230
|
sourceKey: string
|
|
@@ -1228,6 +1233,7 @@ export type DataCommandCollectionCount = DataCommand & {
|
|
|
1228
1233
|
>
|
|
1229
1234
|
outputs?: Array<
|
|
1230
1235
|
| {
|
|
1236
|
+
// Iteratee Callback: true
|
|
1231
1237
|
key: 'iteratee_input'
|
|
1232
1238
|
// target type: object
|
|
1233
1239
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1334,6 +1340,7 @@ export type DataCommandCollectionEvery = DataCommand & {
|
|
|
1334
1340
|
}
|
|
1335
1341
|
| {
|
|
1336
1342
|
// Default value: undefined
|
|
1343
|
+
// Iteratee Callback Input: true
|
|
1337
1344
|
key: 'iteratee_result_valid'
|
|
1338
1345
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
1339
1346
|
sourceKey: string
|
|
@@ -1342,6 +1349,7 @@ export type DataCommandCollectionEvery = DataCommand & {
|
|
|
1342
1349
|
>
|
|
1343
1350
|
outputs?: Array<
|
|
1344
1351
|
| {
|
|
1352
|
+
// Iteratee Callback: true
|
|
1345
1353
|
key: 'iteratee_input'
|
|
1346
1354
|
// target type: object
|
|
1347
1355
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1425,6 +1433,7 @@ export type DataCommandCollectionFilter = DataCommand & {
|
|
|
1425
1433
|
}
|
|
1426
1434
|
| {
|
|
1427
1435
|
// Default value: undefined
|
|
1436
|
+
// Iteratee Callback Input: true
|
|
1428
1437
|
key: 'iteratee_result_valid'
|
|
1429
1438
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
1430
1439
|
sourceKey: string
|
|
@@ -1433,6 +1442,7 @@ export type DataCommandCollectionFilter = DataCommand & {
|
|
|
1433
1442
|
>
|
|
1434
1443
|
outputs?: Array<
|
|
1435
1444
|
| {
|
|
1445
|
+
// Iteratee Callback: true
|
|
1436
1446
|
key: 'iteratee_input'
|
|
1437
1447
|
// target type: object
|
|
1438
1448
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1472,6 +1482,7 @@ export type DataCommandCollectionFind = DataCommand & {
|
|
|
1472
1482
|
}
|
|
1473
1483
|
| {
|
|
1474
1484
|
// Default value: undefined
|
|
1485
|
+
// Iteratee Callback Input: true
|
|
1475
1486
|
key: 'iteratee_result_valid'
|
|
1476
1487
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
1477
1488
|
sourceKey: string
|
|
@@ -1487,6 +1498,7 @@ export type DataCommandCollectionFind = DataCommand & {
|
|
|
1487
1498
|
>
|
|
1488
1499
|
outputs?: Array<
|
|
1489
1500
|
| {
|
|
1501
|
+
// Iteratee Callback: true
|
|
1490
1502
|
key: 'iteratee_input'
|
|
1491
1503
|
// target type: object
|
|
1492
1504
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1526,6 +1538,7 @@ export type DataCommandCollectionFindKey = DataCommand & {
|
|
|
1526
1538
|
}
|
|
1527
1539
|
| {
|
|
1528
1540
|
// Default value: undefined
|
|
1541
|
+
// Iteratee Callback Input: true
|
|
1529
1542
|
key: 'iteratee_result_valid'
|
|
1530
1543
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
1531
1544
|
sourceKey: string
|
|
@@ -1541,6 +1554,7 @@ export type DataCommandCollectionFindKey = DataCommand & {
|
|
|
1541
1554
|
>
|
|
1542
1555
|
outputs?: Array<
|
|
1543
1556
|
| {
|
|
1557
|
+
// Iteratee Callback: true
|
|
1544
1558
|
key: 'iteratee_input'
|
|
1545
1559
|
// target type: object
|
|
1546
1560
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1631,6 +1645,7 @@ export type DataCommandCollectionGroupBy = DataCommand & {
|
|
|
1631
1645
|
}
|
|
1632
1646
|
| {
|
|
1633
1647
|
// Default value: undefined
|
|
1648
|
+
// Iteratee Callback Input: true
|
|
1634
1649
|
key: 'iteratee_result_group'
|
|
1635
1650
|
source: (() => DataCalculationData | DataCommand) | string
|
|
1636
1651
|
sourceKey: string
|
|
@@ -1639,6 +1654,7 @@ export type DataCommandCollectionGroupBy = DataCommand & {
|
|
|
1639
1654
|
>
|
|
1640
1655
|
outputs?: Array<
|
|
1641
1656
|
| {
|
|
1657
|
+
// Iteratee Callback: true
|
|
1642
1658
|
key: 'iteratee_input'
|
|
1643
1659
|
// target type: object
|
|
1644
1660
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1715,6 +1731,7 @@ export type DataCommandCollectionIntersection = DataCommand & {
|
|
|
1715
1731
|
}
|
|
1716
1732
|
| {
|
|
1717
1733
|
// Default value: undefined
|
|
1734
|
+
// Iteratee Callback Input: true
|
|
1718
1735
|
key: 'iteratee_result_value'
|
|
1719
1736
|
source: (() => DataCalculationData | DataCommand) | any
|
|
1720
1737
|
sourceKey: string
|
|
@@ -1723,6 +1740,7 @@ export type DataCommandCollectionIntersection = DataCommand & {
|
|
|
1723
1740
|
>
|
|
1724
1741
|
outputs?: Array<
|
|
1725
1742
|
| {
|
|
1743
|
+
// Iteratee Callback: true
|
|
1726
1744
|
key: 'iteratee_input'
|
|
1727
1745
|
// target type: object
|
|
1728
1746
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1762,6 +1780,7 @@ export type DataCommandCollectionKeyBy = DataCommand & {
|
|
|
1762
1780
|
}
|
|
1763
1781
|
| {
|
|
1764
1782
|
// Default value: undefined
|
|
1783
|
+
// Iteratee Callback Input: true
|
|
1765
1784
|
key: 'iteratee_result_key'
|
|
1766
1785
|
source: (() => DataCalculationData | DataCommand) | string
|
|
1767
1786
|
sourceKey: string
|
|
@@ -1770,6 +1789,7 @@ export type DataCommandCollectionKeyBy = DataCommand & {
|
|
|
1770
1789
|
>
|
|
1771
1790
|
outputs?: Array<
|
|
1772
1791
|
| {
|
|
1792
|
+
// Iteratee Callback: true
|
|
1773
1793
|
key: 'iteratee_input'
|
|
1774
1794
|
// target type: object
|
|
1775
1795
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1830,6 +1850,7 @@ export type DataCommandCollectionMap = DataCommand & {
|
|
|
1830
1850
|
}
|
|
1831
1851
|
| {
|
|
1832
1852
|
// Default value: undefined
|
|
1853
|
+
// Iteratee Callback Input: true
|
|
1833
1854
|
key: 'iteratee_result_value'
|
|
1834
1855
|
source: (() => DataCalculationData | DataCommand) | any
|
|
1835
1856
|
sourceKey: string
|
|
@@ -1838,6 +1859,7 @@ export type DataCommandCollectionMap = DataCommand & {
|
|
|
1838
1859
|
>
|
|
1839
1860
|
outputs?: Array<
|
|
1840
1861
|
| {
|
|
1862
|
+
// Iteratee Callback: true
|
|
1841
1863
|
key: 'iteratee_input'
|
|
1842
1864
|
// target type: object
|
|
1843
1865
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1957,6 +1979,7 @@ export type DataCommandCollectionReduce = DataCommand & {
|
|
|
1957
1979
|
}
|
|
1958
1980
|
| {
|
|
1959
1981
|
// Default value: undefined
|
|
1982
|
+
// Iteratee Callback Input: true
|
|
1960
1983
|
key: 'iteratee_result'
|
|
1961
1984
|
source: (() => DataCalculationData | DataCommand) | any
|
|
1962
1985
|
sourceKey: string
|
|
@@ -1965,6 +1988,7 @@ export type DataCommandCollectionReduce = DataCommand & {
|
|
|
1965
1988
|
>
|
|
1966
1989
|
outputs?: Array<
|
|
1967
1990
|
| {
|
|
1991
|
+
// Iteratee Callback: true
|
|
1968
1992
|
key: 'iteratee_input'
|
|
1969
1993
|
// target type: object
|
|
1970
1994
|
target: () => DataCalculationData | DataCommand
|
|
@@ -2134,6 +2158,7 @@ export type DataCommandCollectionSome = DataCommand & {
|
|
|
2134
2158
|
}
|
|
2135
2159
|
| {
|
|
2136
2160
|
// Default value: undefined
|
|
2161
|
+
// Iteratee Callback Input: true
|
|
2137
2162
|
key: 'iteratee_result_valid'
|
|
2138
2163
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
2139
2164
|
sourceKey: string
|
|
@@ -2142,6 +2167,7 @@ export type DataCommandCollectionSome = DataCommand & {
|
|
|
2142
2167
|
>
|
|
2143
2168
|
outputs?: Array<
|
|
2144
2169
|
| {
|
|
2170
|
+
// Iteratee Callback: true
|
|
2145
2171
|
key: 'iteratee_input'
|
|
2146
2172
|
// target type: object
|
|
2147
2173
|
target: () => DataCalculationData | DataCommand
|
|
@@ -2181,6 +2207,7 @@ export type DataCommandCollectionSort = DataCommand & {
|
|
|
2181
2207
|
}
|
|
2182
2208
|
| {
|
|
2183
2209
|
// Default value: undefined
|
|
2210
|
+
// Iteratee Callback Input: true
|
|
2184
2211
|
key: 'iteratee_result_value'
|
|
2185
2212
|
source: (() => DataCalculationData | DataCommand) | any
|
|
2186
2213
|
sourceKey: string
|
|
@@ -2189,6 +2216,7 @@ export type DataCommandCollectionSort = DataCommand & {
|
|
|
2189
2216
|
>
|
|
2190
2217
|
outputs?: Array<
|
|
2191
2218
|
| {
|
|
2219
|
+
// Iteratee Callback: true
|
|
2192
2220
|
key: 'iteratee_input'
|
|
2193
2221
|
// target type: object
|
|
2194
2222
|
target: () => DataCalculationData | DataCommand
|
|
@@ -2265,6 +2293,7 @@ export type DataCommandCollectionUnion = DataCommand & {
|
|
|
2265
2293
|
}
|
|
2266
2294
|
| {
|
|
2267
2295
|
// Default value: undefined
|
|
2296
|
+
// Iteratee Callback Input: true
|
|
2268
2297
|
key: 'iteratee_result_value'
|
|
2269
2298
|
source: (() => DataCalculationData | DataCommand) | any
|
|
2270
2299
|
sourceKey: string
|
|
@@ -2273,6 +2302,7 @@ export type DataCommandCollectionUnion = DataCommand & {
|
|
|
2273
2302
|
>
|
|
2274
2303
|
outputs?: Array<
|
|
2275
2304
|
| {
|
|
2305
|
+
// Iteratee Callback: true
|
|
2276
2306
|
key: 'iteratee_input'
|
|
2277
2307
|
// target type: object
|
|
2278
2308
|
target: () => DataCalculationData | DataCommand
|
|
@@ -3467,6 +3497,7 @@ export type DataCommandStringReplace = DataCommand & {
|
|
|
3467
3497
|
}
|
|
3468
3498
|
| {
|
|
3469
3499
|
// Default value: undefined
|
|
3500
|
+
// Invocation Callback Input: true
|
|
3470
3501
|
key: 'invocation_result'
|
|
3471
3502
|
source: (() => DataCalculationData | DataCommand) | string
|
|
3472
3503
|
sourceKey: string
|
|
@@ -3489,6 +3520,7 @@ export type DataCommandStringReplace = DataCommand & {
|
|
|
3489
3520
|
>
|
|
3490
3521
|
outputs?: Array<
|
|
3491
3522
|
| {
|
|
3523
|
+
// Invocation Callback: true
|
|
3492
3524
|
key: 'invocation_input'
|
|
3493
3525
|
// target type: object
|
|
3494
3526
|
target: () => DataCalculationData | DataCommand
|
package/types/data.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventAction } from './common'
|
|
1
|
+
import { SubspaceID, EventAction, LocalSyncStrategy } from './common'
|
|
2
2
|
|
|
3
3
|
interface DataDef {
|
|
4
4
|
events?: {
|
|
@@ -15,15 +15,55 @@ interface DataDef {
|
|
|
15
15
|
|
|
16
16
|
export type Data<T = any> = DataDef & {
|
|
17
17
|
__typename: 'Data'
|
|
18
|
-
type: 'string' | 'number' | 'bool' | 'array' | 'object' | 'any'
|
|
19
18
|
id: string
|
|
20
19
|
title: string
|
|
21
20
|
description?: string
|
|
21
|
+
metadata?: {
|
|
22
|
+
linked?: Array<SubspaceID>
|
|
23
|
+
linkedFrom?: SubspaceID
|
|
24
|
+
[key: string]: any
|
|
25
|
+
}
|
|
26
|
+
remoteUpdate?: { type: 'auto' | 'device-specific' } | { type: 'global-data'; id: string }
|
|
22
27
|
// Determine how the property is changed via another subspaces.
|
|
23
28
|
routing?: 'default' | 'read-only'
|
|
24
29
|
// Persist data, so that the data will be keep after refresh.
|
|
25
30
|
persistData?: boolean
|
|
26
|
-
|
|
31
|
+
localSyncUpdateMode?: LocalSyncStrategy
|
|
32
|
+
type: 'string' | 'number' | 'bool' | 'array' | 'object' | 'any'
|
|
33
|
+
schema?: object
|
|
34
|
+
kind?:
|
|
35
|
+
| {
|
|
36
|
+
type: 'id'
|
|
37
|
+
idType?: 'brick' | 'generator' | 'canvas' | 'animation'
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
type: 'auto-generated-item-id'
|
|
41
|
+
idType?: 'canvas'
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
type: 'unit'
|
|
45
|
+
unit?: 'ms' | 'grid' | 'px'
|
|
46
|
+
max?: number
|
|
47
|
+
min?: number
|
|
48
|
+
step?: number
|
|
49
|
+
}
|
|
50
|
+
| {
|
|
51
|
+
type:
|
|
52
|
+
| 'color'
|
|
53
|
+
| 'datetime'
|
|
54
|
+
| 'graphql'
|
|
55
|
+
| 'rich-text-content'
|
|
56
|
+
| 'sandbox-script'
|
|
57
|
+
| 'llm-prompt'
|
|
58
|
+
| 'media-resource-image'
|
|
59
|
+
| 'media-resource-video'
|
|
60
|
+
| 'media-resource-audio'
|
|
61
|
+
| 'media-resource-file'
|
|
62
|
+
| 'lottie-file-uri'
|
|
63
|
+
| 'ggml-model-asset'
|
|
64
|
+
| 'gguf-model-asset'
|
|
65
|
+
| 'binary-asset'
|
|
66
|
+
}
|
|
27
67
|
value: T
|
|
28
68
|
}
|
|
29
69
|
|
package/types/subspace.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Brick, Generator, LocalSyncStrategy, EventAction } from './common'
|
|
1
|
+
import { Brick, Generator, LocalSyncStrategy, EventAction, SubspaceID } from './common'
|
|
2
2
|
import { Animation } from './animation'
|
|
3
3
|
import { Canvas } from './canvas'
|
|
4
4
|
import { Data } from './data'
|
|
@@ -10,6 +10,21 @@ export type Subspace = {
|
|
|
10
10
|
title: string
|
|
11
11
|
description?: string
|
|
12
12
|
localSyncChangeCanvas?: LocalSyncStrategy
|
|
13
|
+
module?: {
|
|
14
|
+
id: string
|
|
15
|
+
version: string
|
|
16
|
+
selectedRequirements?: Array<{
|
|
17
|
+
subspace: SubspaceID
|
|
18
|
+
id: string
|
|
19
|
+
version: string
|
|
20
|
+
}>
|
|
21
|
+
// Module only
|
|
22
|
+
requirements?: Array<{
|
|
23
|
+
subspace: SubspaceID
|
|
24
|
+
id: string
|
|
25
|
+
version: string
|
|
26
|
+
}>
|
|
27
|
+
}
|
|
13
28
|
layout: {
|
|
14
29
|
width: number
|
|
15
30
|
height: number
|
|
@@ -21,6 +36,7 @@ export type Subspace = {
|
|
|
21
36
|
bricks: Array<Brick>
|
|
22
37
|
generators: Array<Generator>
|
|
23
38
|
data: Array<Data>
|
|
39
|
+
dataRouting: Array<Data>
|
|
24
40
|
dataCalculation: Array<DataCalculation>
|
|
25
41
|
actions?: {
|
|
26
42
|
[key: string]: {
|
|
@@ -30,4 +46,3 @@ export type Subspace = {
|
|
|
30
46
|
}
|
|
31
47
|
events?: { [key: string]: Array<EventAction> }
|
|
32
48
|
}
|
|
33
|
-
|