@fugood/bricks-project 2.21.0-beta.14.test0 → 2.21.0-beta.14.test10
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/instance.ts +180 -0
- package/compile/action-name-map.ts +502 -0
- package/compile/index.ts +208 -71
- package/compile/util.ts +2 -2
- package/index.ts +4 -9
- package/package.json +3 -1
- package/tools/deploy.ts +24 -0
- package/tools/postinstall.ts +12 -0
- package/tools/preview-main.mjs +51 -0
- package/tools/preview.ts +37 -0
- package/tools/pull.ts +51 -0
- package/types/bricks.ts +77 -76
- package/types/canvas.ts +4 -4
- package/types/common.ts +12 -9
- package/types/data-calc.ts +34 -1
- package/types/data.ts +43 -3
- package/types/generators.ts +151 -145
- package/types/subspace.ts +21 -6
- package/types/switch.ts +10 -7
- package/types/system.ts +58 -57
- package/utils/calc.ts +118 -0
- package/utils/data.ts +397 -0
- package/{uuid.ts → utils/id.ts} +26 -10
- package/api/application.ts +0 -65
package/types/data-calc.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Data } from './data'
|
|
1
|
+
import type { Data } from './data'
|
|
2
2
|
|
|
3
3
|
export interface DataCalculation {
|
|
4
4
|
__typename: string
|
|
@@ -68,6 +68,7 @@ export type DataCalculationMap = DataCalculation & {
|
|
|
68
68
|
|
|
69
69
|
export type DataCalculationScript = DataCalculation & {
|
|
70
70
|
__typename: 'DataCalculationScript'
|
|
71
|
+
note?: string
|
|
71
72
|
enableAsync: boolean
|
|
72
73
|
code: string
|
|
73
74
|
inputs: Array<{
|
|
@@ -949,6 +950,7 @@ export type DataCommandObjectMapKeys = DataCommand & {
|
|
|
949
950
|
}
|
|
950
951
|
| {
|
|
951
952
|
// Default value: undefined
|
|
953
|
+
// Iteratee Callback Input: true
|
|
952
954
|
key: 'iteratee_result_key'
|
|
953
955
|
source: (() => DataCalculationData | DataCommand) | any
|
|
954
956
|
sourceKey: string
|
|
@@ -957,6 +959,7 @@ export type DataCommandObjectMapKeys = DataCommand & {
|
|
|
957
959
|
>
|
|
958
960
|
outputs?: Array<
|
|
959
961
|
| {
|
|
962
|
+
// Iteratee Callback: true
|
|
960
963
|
key: 'iteratee_input'
|
|
961
964
|
// target type: object
|
|
962
965
|
target: () => DataCalculationData | DataCommand
|
|
@@ -996,6 +999,7 @@ export type DataCommandObjectMapValues = DataCommand & {
|
|
|
996
999
|
}
|
|
997
1000
|
| {
|
|
998
1001
|
// Default value: undefined
|
|
1002
|
+
// Iteratee Callback Input: true
|
|
999
1003
|
key: 'iteratee_result_key'
|
|
1000
1004
|
source: (() => DataCalculationData | DataCommand) | any
|
|
1001
1005
|
sourceKey: string
|
|
@@ -1004,6 +1008,7 @@ export type DataCommandObjectMapValues = DataCommand & {
|
|
|
1004
1008
|
>
|
|
1005
1009
|
outputs?: Array<
|
|
1006
1010
|
| {
|
|
1011
|
+
// Iteratee Callback: true
|
|
1007
1012
|
key: 'iteratee_input'
|
|
1008
1013
|
// target type: object
|
|
1009
1014
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1219,6 +1224,7 @@ export type DataCommandCollectionCount = DataCommand & {
|
|
|
1219
1224
|
}
|
|
1220
1225
|
| {
|
|
1221
1226
|
// Default value: undefined
|
|
1227
|
+
// Iteratee Callback Input: true
|
|
1222
1228
|
key: 'iteratee_result_group'
|
|
1223
1229
|
source: (() => DataCalculationData | DataCommand) | string
|
|
1224
1230
|
sourceKey: string
|
|
@@ -1227,6 +1233,7 @@ export type DataCommandCollectionCount = DataCommand & {
|
|
|
1227
1233
|
>
|
|
1228
1234
|
outputs?: Array<
|
|
1229
1235
|
| {
|
|
1236
|
+
// Iteratee Callback: true
|
|
1230
1237
|
key: 'iteratee_input'
|
|
1231
1238
|
// target type: object
|
|
1232
1239
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1333,6 +1340,7 @@ export type DataCommandCollectionEvery = DataCommand & {
|
|
|
1333
1340
|
}
|
|
1334
1341
|
| {
|
|
1335
1342
|
// Default value: undefined
|
|
1343
|
+
// Iteratee Callback Input: true
|
|
1336
1344
|
key: 'iteratee_result_valid'
|
|
1337
1345
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
1338
1346
|
sourceKey: string
|
|
@@ -1341,6 +1349,7 @@ export type DataCommandCollectionEvery = DataCommand & {
|
|
|
1341
1349
|
>
|
|
1342
1350
|
outputs?: Array<
|
|
1343
1351
|
| {
|
|
1352
|
+
// Iteratee Callback: true
|
|
1344
1353
|
key: 'iteratee_input'
|
|
1345
1354
|
// target type: object
|
|
1346
1355
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1424,6 +1433,7 @@ export type DataCommandCollectionFilter = DataCommand & {
|
|
|
1424
1433
|
}
|
|
1425
1434
|
| {
|
|
1426
1435
|
// Default value: undefined
|
|
1436
|
+
// Iteratee Callback Input: true
|
|
1427
1437
|
key: 'iteratee_result_valid'
|
|
1428
1438
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
1429
1439
|
sourceKey: string
|
|
@@ -1432,6 +1442,7 @@ export type DataCommandCollectionFilter = DataCommand & {
|
|
|
1432
1442
|
>
|
|
1433
1443
|
outputs?: Array<
|
|
1434
1444
|
| {
|
|
1445
|
+
// Iteratee Callback: true
|
|
1435
1446
|
key: 'iteratee_input'
|
|
1436
1447
|
// target type: object
|
|
1437
1448
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1471,6 +1482,7 @@ export type DataCommandCollectionFind = DataCommand & {
|
|
|
1471
1482
|
}
|
|
1472
1483
|
| {
|
|
1473
1484
|
// Default value: undefined
|
|
1485
|
+
// Iteratee Callback Input: true
|
|
1474
1486
|
key: 'iteratee_result_valid'
|
|
1475
1487
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
1476
1488
|
sourceKey: string
|
|
@@ -1486,6 +1498,7 @@ export type DataCommandCollectionFind = DataCommand & {
|
|
|
1486
1498
|
>
|
|
1487
1499
|
outputs?: Array<
|
|
1488
1500
|
| {
|
|
1501
|
+
// Iteratee Callback: true
|
|
1489
1502
|
key: 'iteratee_input'
|
|
1490
1503
|
// target type: object
|
|
1491
1504
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1525,6 +1538,7 @@ export type DataCommandCollectionFindKey = DataCommand & {
|
|
|
1525
1538
|
}
|
|
1526
1539
|
| {
|
|
1527
1540
|
// Default value: undefined
|
|
1541
|
+
// Iteratee Callback Input: true
|
|
1528
1542
|
key: 'iteratee_result_valid'
|
|
1529
1543
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
1530
1544
|
sourceKey: string
|
|
@@ -1540,6 +1554,7 @@ export type DataCommandCollectionFindKey = DataCommand & {
|
|
|
1540
1554
|
>
|
|
1541
1555
|
outputs?: Array<
|
|
1542
1556
|
| {
|
|
1557
|
+
// Iteratee Callback: true
|
|
1543
1558
|
key: 'iteratee_input'
|
|
1544
1559
|
// target type: object
|
|
1545
1560
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1630,6 +1645,7 @@ export type DataCommandCollectionGroupBy = DataCommand & {
|
|
|
1630
1645
|
}
|
|
1631
1646
|
| {
|
|
1632
1647
|
// Default value: undefined
|
|
1648
|
+
// Iteratee Callback Input: true
|
|
1633
1649
|
key: 'iteratee_result_group'
|
|
1634
1650
|
source: (() => DataCalculationData | DataCommand) | string
|
|
1635
1651
|
sourceKey: string
|
|
@@ -1638,6 +1654,7 @@ export type DataCommandCollectionGroupBy = DataCommand & {
|
|
|
1638
1654
|
>
|
|
1639
1655
|
outputs?: Array<
|
|
1640
1656
|
| {
|
|
1657
|
+
// Iteratee Callback: true
|
|
1641
1658
|
key: 'iteratee_input'
|
|
1642
1659
|
// target type: object
|
|
1643
1660
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1714,6 +1731,7 @@ export type DataCommandCollectionIntersection = DataCommand & {
|
|
|
1714
1731
|
}
|
|
1715
1732
|
| {
|
|
1716
1733
|
// Default value: undefined
|
|
1734
|
+
// Iteratee Callback Input: true
|
|
1717
1735
|
key: 'iteratee_result_value'
|
|
1718
1736
|
source: (() => DataCalculationData | DataCommand) | any
|
|
1719
1737
|
sourceKey: string
|
|
@@ -1722,6 +1740,7 @@ export type DataCommandCollectionIntersection = DataCommand & {
|
|
|
1722
1740
|
>
|
|
1723
1741
|
outputs?: Array<
|
|
1724
1742
|
| {
|
|
1743
|
+
// Iteratee Callback: true
|
|
1725
1744
|
key: 'iteratee_input'
|
|
1726
1745
|
// target type: object
|
|
1727
1746
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1761,6 +1780,7 @@ export type DataCommandCollectionKeyBy = DataCommand & {
|
|
|
1761
1780
|
}
|
|
1762
1781
|
| {
|
|
1763
1782
|
// Default value: undefined
|
|
1783
|
+
// Iteratee Callback Input: true
|
|
1764
1784
|
key: 'iteratee_result_key'
|
|
1765
1785
|
source: (() => DataCalculationData | DataCommand) | string
|
|
1766
1786
|
sourceKey: string
|
|
@@ -1769,6 +1789,7 @@ export type DataCommandCollectionKeyBy = DataCommand & {
|
|
|
1769
1789
|
>
|
|
1770
1790
|
outputs?: Array<
|
|
1771
1791
|
| {
|
|
1792
|
+
// Iteratee Callback: true
|
|
1772
1793
|
key: 'iteratee_input'
|
|
1773
1794
|
// target type: object
|
|
1774
1795
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1829,6 +1850,7 @@ export type DataCommandCollectionMap = DataCommand & {
|
|
|
1829
1850
|
}
|
|
1830
1851
|
| {
|
|
1831
1852
|
// Default value: undefined
|
|
1853
|
+
// Iteratee Callback Input: true
|
|
1832
1854
|
key: 'iteratee_result_value'
|
|
1833
1855
|
source: (() => DataCalculationData | DataCommand) | any
|
|
1834
1856
|
sourceKey: string
|
|
@@ -1837,6 +1859,7 @@ export type DataCommandCollectionMap = DataCommand & {
|
|
|
1837
1859
|
>
|
|
1838
1860
|
outputs?: Array<
|
|
1839
1861
|
| {
|
|
1862
|
+
// Iteratee Callback: true
|
|
1840
1863
|
key: 'iteratee_input'
|
|
1841
1864
|
// target type: object
|
|
1842
1865
|
target: () => DataCalculationData | DataCommand
|
|
@@ -1956,6 +1979,7 @@ export type DataCommandCollectionReduce = DataCommand & {
|
|
|
1956
1979
|
}
|
|
1957
1980
|
| {
|
|
1958
1981
|
// Default value: undefined
|
|
1982
|
+
// Iteratee Callback Input: true
|
|
1959
1983
|
key: 'iteratee_result'
|
|
1960
1984
|
source: (() => DataCalculationData | DataCommand) | any
|
|
1961
1985
|
sourceKey: string
|
|
@@ -1964,6 +1988,7 @@ export type DataCommandCollectionReduce = DataCommand & {
|
|
|
1964
1988
|
>
|
|
1965
1989
|
outputs?: Array<
|
|
1966
1990
|
| {
|
|
1991
|
+
// Iteratee Callback: true
|
|
1967
1992
|
key: 'iteratee_input'
|
|
1968
1993
|
// target type: object
|
|
1969
1994
|
target: () => DataCalculationData | DataCommand
|
|
@@ -2133,6 +2158,7 @@ export type DataCommandCollectionSome = DataCommand & {
|
|
|
2133
2158
|
}
|
|
2134
2159
|
| {
|
|
2135
2160
|
// Default value: undefined
|
|
2161
|
+
// Iteratee Callback Input: true
|
|
2136
2162
|
key: 'iteratee_result_valid'
|
|
2137
2163
|
source: (() => DataCalculationData | DataCommand) | boolean
|
|
2138
2164
|
sourceKey: string
|
|
@@ -2141,6 +2167,7 @@ export type DataCommandCollectionSome = DataCommand & {
|
|
|
2141
2167
|
>
|
|
2142
2168
|
outputs?: Array<
|
|
2143
2169
|
| {
|
|
2170
|
+
// Iteratee Callback: true
|
|
2144
2171
|
key: 'iteratee_input'
|
|
2145
2172
|
// target type: object
|
|
2146
2173
|
target: () => DataCalculationData | DataCommand
|
|
@@ -2180,6 +2207,7 @@ export type DataCommandCollectionSort = DataCommand & {
|
|
|
2180
2207
|
}
|
|
2181
2208
|
| {
|
|
2182
2209
|
// Default value: undefined
|
|
2210
|
+
// Iteratee Callback Input: true
|
|
2183
2211
|
key: 'iteratee_result_value'
|
|
2184
2212
|
source: (() => DataCalculationData | DataCommand) | any
|
|
2185
2213
|
sourceKey: string
|
|
@@ -2188,6 +2216,7 @@ export type DataCommandCollectionSort = DataCommand & {
|
|
|
2188
2216
|
>
|
|
2189
2217
|
outputs?: Array<
|
|
2190
2218
|
| {
|
|
2219
|
+
// Iteratee Callback: true
|
|
2191
2220
|
key: 'iteratee_input'
|
|
2192
2221
|
// target type: object
|
|
2193
2222
|
target: () => DataCalculationData | DataCommand
|
|
@@ -2264,6 +2293,7 @@ export type DataCommandCollectionUnion = DataCommand & {
|
|
|
2264
2293
|
}
|
|
2265
2294
|
| {
|
|
2266
2295
|
// Default value: undefined
|
|
2296
|
+
// Iteratee Callback Input: true
|
|
2267
2297
|
key: 'iteratee_result_value'
|
|
2268
2298
|
source: (() => DataCalculationData | DataCommand) | any
|
|
2269
2299
|
sourceKey: string
|
|
@@ -2272,6 +2302,7 @@ export type DataCommandCollectionUnion = DataCommand & {
|
|
|
2272
2302
|
>
|
|
2273
2303
|
outputs?: Array<
|
|
2274
2304
|
| {
|
|
2305
|
+
// Iteratee Callback: true
|
|
2275
2306
|
key: 'iteratee_input'
|
|
2276
2307
|
// target type: object
|
|
2277
2308
|
target: () => DataCalculationData | DataCommand
|
|
@@ -3466,6 +3497,7 @@ export type DataCommandStringReplace = DataCommand & {
|
|
|
3466
3497
|
}
|
|
3467
3498
|
| {
|
|
3468
3499
|
// Default value: undefined
|
|
3500
|
+
// Invocation Callback Input: true
|
|
3469
3501
|
key: 'invocation_result'
|
|
3470
3502
|
source: (() => DataCalculationData | DataCommand) | string
|
|
3471
3503
|
sourceKey: string
|
|
@@ -3488,6 +3520,7 @@ export type DataCommandStringReplace = DataCommand & {
|
|
|
3488
3520
|
>
|
|
3489
3521
|
outputs?: Array<
|
|
3490
3522
|
| {
|
|
3523
|
+
// Invocation Callback: true
|
|
3491
3524
|
key: 'invocation_input'
|
|
3492
3525
|
// target type: object
|
|
3493
3526
|
target: () => DataCalculationData | DataCommand
|
package/types/data.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventAction } from './common'
|
|
1
|
+
import type { 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
|
|