@fugood/bricks-project 2.25.0-beta.22 → 2.25.0-beta.23
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/compile/index.ts +1 -1
- package/package.json +1 -1
- package/package.json.bak +1 -1
- package/skills/bricks-ctor/rules/data-calculation.md +2 -0
- package/tools/_shell.ts +8 -1
- package/tools/mcp-tools/compile.ts +15 -7
- package/tools/mcp-tools/media.ts +4 -1
- package/types/common.ts +2 -2
- package/types/data-calc-command/base.ts +57 -0
- package/types/data-calc-command/collection.ts +418 -0
- package/types/data-calc-command/color.ts +432 -0
- package/types/data-calc-command/constant.ts +50 -0
- package/types/data-calc-command/datetime.ts +147 -0
- package/types/data-calc-command/file.ts +129 -0
- package/types/data-calc-command/index.ts +13 -0
- package/types/data-calc-command/iteratee.ts +23 -0
- package/types/data-calc-command/logictype.ts +190 -0
- package/types/data-calc-command/math.ts +275 -0
- package/types/data-calc-command/object.ts +119 -0
- package/types/data-calc-command/sandbox.ts +58 -0
- package/types/data-calc-command/string.ts +407 -0
- package/types/data.ts +1 -1
- package/utils/data.ts +1 -1
- package/types/data-calc-command.ts +0 -7005
package/compile/index.ts
CHANGED
|
@@ -1194,7 +1194,7 @@ export const compile = async (app: Application) => {
|
|
|
1194
1194
|
...compileRemoteUpdate(data.remoteUpdate),
|
|
1195
1195
|
routing: data.routing,
|
|
1196
1196
|
schema: data.schema,
|
|
1197
|
-
type: data.type,
|
|
1197
|
+
type: data.type === 'boolean' ? 'bool' : data.type,
|
|
1198
1198
|
...compileKind(data.kind),
|
|
1199
1199
|
value: compileProperty(data.value, `(data: ${dataId}, subspace ${subspaceId})`),
|
|
1200
1200
|
event_map: compileEvents('PROPERTY_BANK', data.events || {}, {
|
package/package.json
CHANGED
package/package.json.bak
CHANGED
|
@@ -182,6 +182,8 @@ const triggerCalc: EventAction = {
|
|
|
182
182
|
}
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
+
When the same chain writes a calc input (e.g. `PROPERTY_BANK` setting `dLastButton`) then issues `PROPERTY_BANK_COMMAND`, set `waitAsync: true` on the write so the calc reads the new value rather than the pre-chain snapshot. See [Event Action Chains](architecture-patterns.md#event-action-chains-priority-2).
|
|
186
|
+
|
|
185
187
|
## Best Practices
|
|
186
188
|
|
|
187
189
|
1. **Avoid circular deps**: Set non-triggering inputs (`trigger: false`) or use `manual` mode
|
package/tools/_shell.ts
CHANGED
|
@@ -29,6 +29,7 @@ class Sh implements PromiseLike<ShResult> {
|
|
|
29
29
|
private _cwd: string | undefined
|
|
30
30
|
private _mode: Mode = 'default'
|
|
31
31
|
private _throw = true
|
|
32
|
+
private _env: NodeJS.ProcessEnv | undefined
|
|
32
33
|
private _promise: Promise<ShResult> | null = null
|
|
33
34
|
|
|
34
35
|
constructor(private readonly args: string[]) {}
|
|
@@ -48,6 +49,11 @@ class Sh implements PromiseLike<ShResult> {
|
|
|
48
49
|
return this
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
env(extra: NodeJS.ProcessEnv): this {
|
|
53
|
+
this._env = { ...this._env, ...extra }
|
|
54
|
+
return this
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
async text(): Promise<string> {
|
|
52
58
|
// If no explicit quiet was requested, capture stdout/stderr without
|
|
53
59
|
// forwarding them to the parent's streams (matches Bun's `.text()`).
|
|
@@ -79,7 +85,8 @@ class Sh implements PromiseLike<ShResult> {
|
|
|
79
85
|
? ['ignore', 'pipe', 'pipe']
|
|
80
86
|
: ['inherit', 'pipe', 'pipe']
|
|
81
87
|
|
|
82
|
-
const
|
|
88
|
+
const env = this._env ? { ...process.env, ...this._env } : undefined
|
|
89
|
+
const proc = spawn(cmd, rest, { cwd: this._cwd, stdio, env })
|
|
83
90
|
|
|
84
91
|
const outChunks: Buffer[] = []
|
|
85
92
|
const errChunks: Buffer[] = []
|
|
@@ -3,16 +3,21 @@ import { readFile } from 'node:fs/promises'
|
|
|
3
3
|
import { z } from 'zod'
|
|
4
4
|
import { sh } from '../_shell'
|
|
5
5
|
|
|
6
|
+
// Disable ANSI color codes from spawned tools so MCP text output stays readable
|
|
7
|
+
// (the host renders raw text; escape sequences leak into the result otherwise).
|
|
8
|
+
const noColorEnv = { FORCE_COLOR: '0', NO_COLOR: '1' }
|
|
9
|
+
|
|
6
10
|
export function register(server: McpServer, projectDir: string) {
|
|
7
11
|
const { dirname } = import.meta
|
|
8
12
|
|
|
9
13
|
server.tool('compile', {}, async () => {
|
|
10
|
-
let log = ''
|
|
14
|
+
let log = 'Type checking & Compiling...\n'
|
|
11
15
|
try {
|
|
12
|
-
log +=
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
log += await sh`bun compile`.cwd(projectDir).env(noColorEnv).text()
|
|
17
|
+
} catch (err: any) {
|
|
18
|
+
const stdout = err.stdout?.toString() ?? ''
|
|
19
|
+
const stderr = err.stderr?.toString() ?? ''
|
|
20
|
+
log += [stdout, stderr].filter(Boolean).join('\n')
|
|
16
21
|
}
|
|
17
22
|
return {
|
|
18
23
|
content: [{ type: 'text', text: log }],
|
|
@@ -65,9 +70,12 @@ export function register(server: McpServer, projectDir: string) {
|
|
|
65
70
|
if (testTitleLike) args.push('--test-title-like', testTitleLike)
|
|
66
71
|
log = await sh`bunx --bun electron ${toolsDir}/preview-main.mjs ${args}`
|
|
67
72
|
.cwd(projectDir)
|
|
73
|
+
.env(noColorEnv)
|
|
68
74
|
.text()
|
|
69
|
-
} catch (err) {
|
|
70
|
-
|
|
75
|
+
} catch (err: any) {
|
|
76
|
+
const stdout = err.stdout?.toString() ?? ''
|
|
77
|
+
const stderr = err.stderr?.toString() ?? ''
|
|
78
|
+
log = [stdout, stderr].filter(Boolean).join('\n')
|
|
71
79
|
error = true
|
|
72
80
|
}
|
|
73
81
|
let screenshotBase64: string | null = null
|
package/tools/mcp-tools/media.ts
CHANGED
|
@@ -2,9 +2,12 @@ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
import { sh } from '../_shell'
|
|
4
4
|
|
|
5
|
+
// MCP results are rendered as raw text — disable ANSI colors from the child.
|
|
6
|
+
const noColorEnv = { FORCE_COLOR: '0', NO_COLOR: '1' }
|
|
7
|
+
|
|
5
8
|
const runBricks = async (projectDir: string, ...args: string[]) => {
|
|
6
9
|
try {
|
|
7
|
-
return await sh`bunx bricks ${args}`.cwd(projectDir).text()
|
|
10
|
+
return await sh`bunx bricks ${args}`.cwd(projectDir).env(noColorEnv).text()
|
|
8
11
|
} catch (err: any) {
|
|
9
12
|
throw new Error(err.stderr?.toString() || err.message)
|
|
10
13
|
}
|
package/types/common.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface Brick {
|
|
|
12
12
|
description?: string
|
|
13
13
|
hideShortRef?: boolean
|
|
14
14
|
property?: {}
|
|
15
|
-
events
|
|
15
|
+
events?: {}
|
|
16
16
|
outlets?: {}
|
|
17
17
|
animation?: {}
|
|
18
18
|
switches?: Array<SwitchDef>
|
|
@@ -33,7 +33,7 @@ export interface Generator {
|
|
|
33
33
|
hideShortRef?: boolean
|
|
34
34
|
localSyncRunMode?: LocalSyncStrategy
|
|
35
35
|
property?: {}
|
|
36
|
-
events
|
|
36
|
+
events?: {}
|
|
37
37
|
outlets?: {}
|
|
38
38
|
switches?: Array<SwitchDef>
|
|
39
39
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* Auto generated by build script */
|
|
2
|
+
import type { Data } from '../data'
|
|
3
|
+
import type { DataCalculation } from '../data-calc'
|
|
4
|
+
|
|
5
|
+
// Shared helpers — every generated DataCommand{Name} reuses these to describe
|
|
6
|
+
// its narrowed inputs/outputs, so the per-command files stay short.
|
|
7
|
+
export type DataCalcInput<K extends string = string, T = any> = {
|
|
8
|
+
key: K
|
|
9
|
+
source: (() => DataCalculationData | DataCommand) | T
|
|
10
|
+
sourceKey: string
|
|
11
|
+
trigger?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type DataCalcOutput<K extends string = string> = {
|
|
15
|
+
key: K
|
|
16
|
+
target: () => DataCalculationData | DataCommand
|
|
17
|
+
targetKey: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface DataCalculationData {
|
|
21
|
+
__typename: 'DataCalculationData'
|
|
22
|
+
title?: string
|
|
23
|
+
description?: string
|
|
24
|
+
hideShortRef?: boolean
|
|
25
|
+
data: () => Data
|
|
26
|
+
// 'change' is the only valid input port on a data node; the source must be
|
|
27
|
+
// another node (no inline literals), hence `never` for the second type arg.
|
|
28
|
+
inputs: Array<DataCalcInput<'change', never>>
|
|
29
|
+
outputs: Array<DataCalcOutput<'value'>>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface DataCommand {
|
|
33
|
+
__typename: 'DataCommand'
|
|
34
|
+
__commandName: string
|
|
35
|
+
id: string
|
|
36
|
+
title?: string
|
|
37
|
+
description?: string
|
|
38
|
+
hideShortRef?: boolean
|
|
39
|
+
inputs: Array<DataCalcInput>
|
|
40
|
+
outputs: Array<DataCalcOutput>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type DataCalculationMap = DataCalculation & {
|
|
44
|
+
__typename: 'DataCalculationMap'
|
|
45
|
+
nodes: Array<DataCalculationData | DataCommand>
|
|
46
|
+
editorInfo: Array<{
|
|
47
|
+
node: DataCalculationData | DataCommand
|
|
48
|
+
position: { x: number; y: number }
|
|
49
|
+
points: Array<{
|
|
50
|
+
source: DataCalculationData | DataCommand
|
|
51
|
+
sourceOutputKey: string
|
|
52
|
+
target: DataCalculationData | DataCommand
|
|
53
|
+
targetInputKey: string
|
|
54
|
+
positions: Array<{ x: number; y: number }>
|
|
55
|
+
}>
|
|
56
|
+
}>
|
|
57
|
+
}
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
/* Auto generated by build script */
|
|
2
|
+
import type { DataCalculationData, DataCommand, DataCalcInput, DataCalcOutput } from './base'
|
|
3
|
+
|
|
4
|
+
/* Compact — Remove false, undefined, 0, "", undefined, NaN in array */
|
|
5
|
+
export type DataCommandCollectionCompact = DataCommand & {
|
|
6
|
+
__commandName: 'COLLECTION_COMPACT'
|
|
7
|
+
inputs?: Array<DataCalcInput<'collection', Array<any>> /* default: [] */>
|
|
8
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Concat — Concat object or array. Return empty array if no var provided. */
|
|
12
|
+
export type DataCommandCollectionConcat = DataCommand & {
|
|
13
|
+
__commandName: 'COLLECTION_CONCAT'
|
|
14
|
+
inputs?: Array<
|
|
15
|
+
| DataCalcInput<'var1', any> /* default: [] */
|
|
16
|
+
| DataCalcInput<'var2', any> /* default: [] */
|
|
17
|
+
| DataCalcInput<'var3', any> /* default: [] */
|
|
18
|
+
>
|
|
19
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Count — Group the contents of arrays or objects and output individual counts.
|
|
23
|
+
If group_by_path provided, it will use value from path to group, use whole value as key if path is empty string, then output to result.
|
|
24
|
+
If group_by_path not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_group, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
25
|
+
export type DataCommandCollectionCount = DataCommand & {
|
|
26
|
+
__commandName: 'COLLECTION_COUNT'
|
|
27
|
+
inputs?: Array<
|
|
28
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
29
|
+
| DataCalcInput<'group_by_path', string> /* default: undefined */
|
|
30
|
+
| DataCalcInput<
|
|
31
|
+
'iteratee_result_group',
|
|
32
|
+
string
|
|
33
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
34
|
+
>
|
|
35
|
+
outputs?: Array<
|
|
36
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
37
|
+
| DataCalcOutput<'result'> /* target: object */
|
|
38
|
+
>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Difference — Creates an array of array values not included in the other given arrays. */
|
|
42
|
+
export type DataCommandCollectionDifference = DataCommand & {
|
|
43
|
+
__commandName: 'COLLECTION_DIFFERENCE'
|
|
44
|
+
inputs?: Array<
|
|
45
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
46
|
+
| DataCalcInput<'values', Array<any>> /* default: [] */
|
|
47
|
+
>
|
|
48
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Drop — Drop values with number in array or object. */
|
|
52
|
+
export type DataCommandCollectionDrop = DataCommand & {
|
|
53
|
+
__commandName: 'COLLECTION_DROP'
|
|
54
|
+
inputs?: Array<
|
|
55
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
56
|
+
| DataCalcInput<'number', any> /* default: 1 */
|
|
57
|
+
| DataCalcInput<'forward', boolean> /* default: true */
|
|
58
|
+
>
|
|
59
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Every — Whether all the contents in the array or object meet the conditions.
|
|
63
|
+
If predicate provided, it will use LOGICTYPE_EQUAL_VALUE to compare, then output to result.
|
|
64
|
+
If predicate not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_valid, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
65
|
+
export type DataCommandCollectionEvery = DataCommand & {
|
|
66
|
+
__commandName: 'COLLECTION_EVERY'
|
|
67
|
+
inputs?: Array<
|
|
68
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
69
|
+
| DataCalcInput<'predicate', object> /* default: undefined */
|
|
70
|
+
| DataCalcInput<
|
|
71
|
+
'iteratee_result_valid',
|
|
72
|
+
boolean
|
|
73
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
74
|
+
>
|
|
75
|
+
outputs?: Array<
|
|
76
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
77
|
+
| DataCalcOutput<'result'> /* target: boolean */
|
|
78
|
+
>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Fill — Fill value in array with length. Example: COLLECTION_FILL(start=2, length=2, value='A') Result:[undefined, undefined, 'A', 'A'] */
|
|
82
|
+
export type DataCommandCollectionFill = DataCommand & {
|
|
83
|
+
__commandName: 'COLLECTION_FILL'
|
|
84
|
+
inputs?: Array<
|
|
85
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
86
|
+
| DataCalcInput<'start', any> /* default: 0 */
|
|
87
|
+
| DataCalcInput<'length', any> /* default: length to end of array */
|
|
88
|
+
| DataCalcInput<'value', any> /* default: undefined */
|
|
89
|
+
>
|
|
90
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Filter — Filter the content that meets the conditions in the array or object.
|
|
94
|
+
If predicate provided, it will use LOGICTYPE_EQUAL_VALUE to compare, then output to result.
|
|
95
|
+
If predicate not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_valid, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
96
|
+
export type DataCommandCollectionFilter = DataCommand & {
|
|
97
|
+
__commandName: 'COLLECTION_FILTER'
|
|
98
|
+
inputs?: Array<
|
|
99
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
100
|
+
| DataCalcInput<'predicate', object> /* default: undefined */
|
|
101
|
+
| DataCalcInput<
|
|
102
|
+
'iteratee_result_valid',
|
|
103
|
+
boolean
|
|
104
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
105
|
+
>
|
|
106
|
+
outputs?: Array<
|
|
107
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
108
|
+
| DataCalcOutput<'result'> /* target: any */
|
|
109
|
+
>
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Find — Find first value by condition in array.
|
|
113
|
+
If predicate provided, it will use LOGICTYPE_EQUAL_VALUE to compare, then output to result.
|
|
114
|
+
If predicate not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_valid, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
115
|
+
export type DataCommandCollectionFind = DataCommand & {
|
|
116
|
+
__commandName: 'COLLECTION_FIND'
|
|
117
|
+
inputs?: Array<
|
|
118
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
119
|
+
| DataCalcInput<'predicate', object> /* default: undefined */
|
|
120
|
+
| DataCalcInput<
|
|
121
|
+
'iteratee_result_valid',
|
|
122
|
+
boolean
|
|
123
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
124
|
+
| DataCalcInput<'forward', boolean> /* default: true */
|
|
125
|
+
>
|
|
126
|
+
outputs?: Array<
|
|
127
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
128
|
+
| DataCalcOutput<'result'> /* target: any */
|
|
129
|
+
>
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Find Key — Find key of first value by condition in array.
|
|
133
|
+
If predicate provided, it will use LOGICTYPE_EQUAL_VALUE to compare, then output to result.
|
|
134
|
+
If predicate not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_valid, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
135
|
+
export type DataCommandCollectionFindKey = DataCommand & {
|
|
136
|
+
__commandName: 'COLLECTION_FIND_KEY'
|
|
137
|
+
inputs?: Array<
|
|
138
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
139
|
+
| DataCalcInput<'predicate', object> /* default: undefined */
|
|
140
|
+
| DataCalcInput<
|
|
141
|
+
'iteratee_result_valid',
|
|
142
|
+
boolean
|
|
143
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
144
|
+
| DataCalcInput<'forward', boolean> /* default: true */
|
|
145
|
+
>
|
|
146
|
+
outputs?: Array<
|
|
147
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
148
|
+
| DataCalcOutput<'result'> /* target: any */
|
|
149
|
+
>
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* First — Get first value in array */
|
|
153
|
+
export type DataCommandCollectionFirst = DataCommand & {
|
|
154
|
+
__commandName: 'COLLECTION_FIRST'
|
|
155
|
+
inputs?: Array<DataCalcInput<'array', Array<any>> /* default: [] */>
|
|
156
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Flatten — Flatten a single level deep or recursively deep. */
|
|
160
|
+
export type DataCommandCollectionFlatten = DataCommand & {
|
|
161
|
+
__commandName: 'COLLECTION_FLATTEN'
|
|
162
|
+
inputs?: Array<
|
|
163
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
164
|
+
| DataCalcInput<'deep', boolean> /* default: true */
|
|
165
|
+
>
|
|
166
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Group By — Group array elements or object attributes into groups and generate objects.
|
|
170
|
+
If group_by_path provided, it will use value from path to group, use whole value as key if path is empty string, then output to result.
|
|
171
|
+
If group_by_path not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_group, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
172
|
+
export type DataCommandCollectionGroupBy = DataCommand & {
|
|
173
|
+
__commandName: 'COLLECTION_GROUP_BY'
|
|
174
|
+
inputs?: Array<
|
|
175
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
176
|
+
| DataCalcInput<'group_by_path', string> /* default: undefined */
|
|
177
|
+
| DataCalcInput<
|
|
178
|
+
'iteratee_result_group',
|
|
179
|
+
string
|
|
180
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
181
|
+
>
|
|
182
|
+
outputs?: Array<
|
|
183
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
184
|
+
| DataCalcOutput<'result'> /* target: object */
|
|
185
|
+
>
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* Includes — Check value in array. */
|
|
189
|
+
export type DataCommandCollectionIncludes = DataCommand & {
|
|
190
|
+
__commandName: 'COLLECTION_INCLUDES'
|
|
191
|
+
inputs?: Array<
|
|
192
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
193
|
+
| DataCalcInput<'value', any> /* default: undefined */
|
|
194
|
+
| DataCalcInput<'from_index', any> /* default: 0 */
|
|
195
|
+
>
|
|
196
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: boolean */>
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* Intersection — Get arrays intersection.
|
|
200
|
+
If intersection_by_path provided, it will use value from path to intersect, use whole value as key if path is empty string, then output to result.
|
|
201
|
+
If intersection_by_path not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_value, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
202
|
+
export type DataCommandCollectionIntersection = DataCommand & {
|
|
203
|
+
__commandName: 'COLLECTION_INTERSECTION'
|
|
204
|
+
inputs?: Array<
|
|
205
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
206
|
+
| DataCalcInput<'intersection_by_path', string> /* default: undefined */
|
|
207
|
+
| DataCalcInput<
|
|
208
|
+
'iteratee_result_value',
|
|
209
|
+
any
|
|
210
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
211
|
+
>
|
|
212
|
+
outputs?: Array<
|
|
213
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
214
|
+
| DataCalcOutput<'result'> /* target: any */
|
|
215
|
+
>
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* Key By — Use the specified value as the property name of the new object.
|
|
219
|
+
If key_by_path provided, it will use value from path as key, use whole value as key if path is empty string, then output to result.
|
|
220
|
+
If key_by_path not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_key, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
221
|
+
export type DataCommandCollectionKeyBy = DataCommand & {
|
|
222
|
+
__commandName: 'COLLECTION_KEY_BY'
|
|
223
|
+
inputs?: Array<
|
|
224
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
225
|
+
| DataCalcInput<'key_by_path', string> /* default: undefined */
|
|
226
|
+
| DataCalcInput<
|
|
227
|
+
'iteratee_result_key',
|
|
228
|
+
string
|
|
229
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
230
|
+
>
|
|
231
|
+
outputs?: Array<
|
|
232
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
233
|
+
| DataCalcOutput<'result'> /* target: object */
|
|
234
|
+
>
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* Last — Get last value of array. */
|
|
238
|
+
export type DataCommandCollectionLast = DataCommand & {
|
|
239
|
+
__commandName: 'COLLECTION_LAST'
|
|
240
|
+
inputs?: Array<DataCalcInput<'array', Array<any>> /* default: [] */>
|
|
241
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* Map — Map to new array.
|
|
245
|
+
If map_by_path provided, it will use value from path, use whole value if path is empty string, then output to result.
|
|
246
|
+
If map_by_path not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_value, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
247
|
+
export type DataCommandCollectionMap = DataCommand & {
|
|
248
|
+
__commandName: 'COLLECTION_MAP'
|
|
249
|
+
inputs?: Array<
|
|
250
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
251
|
+
| DataCalcInput<'map_by_path', string> /* default: undefined */
|
|
252
|
+
| DataCalcInput<
|
|
253
|
+
'iteratee_result_value',
|
|
254
|
+
any
|
|
255
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
256
|
+
>
|
|
257
|
+
outputs?: Array<
|
|
258
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
259
|
+
| DataCalcOutput<'result'> /* target: any */
|
|
260
|
+
>
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* Nth — Get N th value of array. */
|
|
264
|
+
export type DataCommandCollectionNth = DataCommand & {
|
|
265
|
+
__commandName: 'COLLECTION_NTH'
|
|
266
|
+
inputs?: Array<
|
|
267
|
+
DataCalcInput<'array', Array<any>> /* default: [] */ | DataCalcInput<'n', any> /* default: 0 */
|
|
268
|
+
>
|
|
269
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* Push — Push value into array. */
|
|
273
|
+
export type DataCommandCollectionPush = DataCommand & {
|
|
274
|
+
__commandName: 'COLLECTION_PUSH'
|
|
275
|
+
inputs?: Array<
|
|
276
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
277
|
+
| DataCalcInput<'forward', boolean> /* default: true */
|
|
278
|
+
| DataCalcInput<'var1', any> /* default: undefined */
|
|
279
|
+
| DataCalcInput<'var2', any> /* default: undefined */
|
|
280
|
+
| DataCalcInput<'var3', any> /* default: undefined */
|
|
281
|
+
>
|
|
282
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/* Reduce — Reduce the array to a single result.
|
|
286
|
+
It will trigger iteratee_input callback for every property (With { result, key, value }). After the calculation triggered iteratee_result, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
287
|
+
export type DataCommandCollectionReduce = DataCommand & {
|
|
288
|
+
__commandName: 'COLLECTION_REDUCE'
|
|
289
|
+
inputs?: Array<
|
|
290
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
291
|
+
| DataCalcInput<'initial_value', any> /* default: undefined */
|
|
292
|
+
| DataCalcInput<'iteratee_result', any> /* iteratee callback input */ /* default: undefined */
|
|
293
|
+
>
|
|
294
|
+
outputs?: Array<
|
|
295
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
296
|
+
| DataCalcOutput<'result'> /* target: any */
|
|
297
|
+
>
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* Reverse — Reverse array */
|
|
301
|
+
export type DataCommandCollectionReverse = DataCommand & {
|
|
302
|
+
__commandName: 'COLLECTION_REVERSE'
|
|
303
|
+
inputs?: Array<DataCalcInput<'array', Array<any>> /* default: [] */>
|
|
304
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/* Sample — Get N th value of array randomly. */
|
|
308
|
+
export type DataCommandCollectionSample = DataCommand & {
|
|
309
|
+
__commandName: 'COLLECTION_SAMPLE'
|
|
310
|
+
inputs?: Array<
|
|
311
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
312
|
+
| DataCalcInput<'n', any> /* default: 0 */
|
|
313
|
+
>
|
|
314
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* Shuffie — Shuffie array order. */
|
|
318
|
+
export type DataCommandCollectionShuffle = DataCommand & {
|
|
319
|
+
__commandName: 'COLLECTION_SHUFFLE'
|
|
320
|
+
inputs?: Array<DataCalcInput<'array', Array<any>> /* default: [] */>
|
|
321
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/* Size — Get array size. */
|
|
325
|
+
export type DataCommandCollectionSize = DataCommand & {
|
|
326
|
+
__commandName: 'COLLECTION_SIZE'
|
|
327
|
+
inputs?: Array<DataCalcInput<'collection', Array<any> | object> /* default: [] */>
|
|
328
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/* Slice — Slice array. */
|
|
332
|
+
export type DataCommandCollectionSlice = DataCommand & {
|
|
333
|
+
__commandName: 'COLLECTION_SLICE'
|
|
334
|
+
inputs?: Array<
|
|
335
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
336
|
+
| DataCalcInput<'start', any> /* default: 0 */
|
|
337
|
+
| DataCalcInput<'end', any> /* default: Array length */
|
|
338
|
+
>
|
|
339
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/* Some — Check whether any of the array or object property meets the conditions.
|
|
343
|
+
If predicate provided, it will use LOGICTYPE_EQUAL_VALUE to compare, then output to result.
|
|
344
|
+
If predicate not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_valid, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
345
|
+
export type DataCommandCollectionSome = DataCommand & {
|
|
346
|
+
__commandName: 'COLLECTION_SOME'
|
|
347
|
+
inputs?: Array<
|
|
348
|
+
| DataCalcInput<'collection', Array<any> | object> /* default: [] */
|
|
349
|
+
| DataCalcInput<'predicate', object> /* default: undefined */
|
|
350
|
+
| DataCalcInput<
|
|
351
|
+
'iteratee_result_valid',
|
|
352
|
+
boolean
|
|
353
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
354
|
+
>
|
|
355
|
+
outputs?: Array<
|
|
356
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
357
|
+
| DataCalcOutput<'result'> /* target: boolean */
|
|
358
|
+
>
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/* Sort — Sort array.
|
|
362
|
+
If sort_by_path provided, it will use value from path to sort, use whole value if path is empty string, then output to result.
|
|
363
|
+
If sort_by_path not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_value, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
364
|
+
export type DataCommandCollectionSort = DataCommand & {
|
|
365
|
+
__commandName: 'COLLECTION_SORT'
|
|
366
|
+
inputs?: Array<
|
|
367
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
368
|
+
| DataCalcInput<'sort_by_path', string | Array<any>> /* default: undefined */
|
|
369
|
+
| DataCalcInput<
|
|
370
|
+
'iteratee_result_value',
|
|
371
|
+
any
|
|
372
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
373
|
+
>
|
|
374
|
+
outputs?: Array<
|
|
375
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
376
|
+
| DataCalcOutput<'result'> /* target: any */
|
|
377
|
+
>
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/* Take — Creates a slice of array with n elements taken from the beginning. */
|
|
381
|
+
export type DataCommandCollectionTake = DataCommand & {
|
|
382
|
+
__commandName: 'COLLECTION_TAKE'
|
|
383
|
+
inputs?: Array<
|
|
384
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
385
|
+
| DataCalcInput<'n', any> /* default: 1 */
|
|
386
|
+
| DataCalcInput<'forward', boolean> /* default: true */
|
|
387
|
+
>
|
|
388
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/* Union — Creates an array of unique values, in order, from all given arrays.
|
|
392
|
+
If union_by_path provided, it will use path to compare, then output to result.
|
|
393
|
+
If union_by_path not provided, it will trigger iteratee_input callback for every property (With { key, value }). After the calculation triggered iteratee_result_value, it will confirm whether to continue the next trigger of iteratee_input. Finally, it will trigger result output. */
|
|
394
|
+
export type DataCommandCollectionUnion = DataCommand & {
|
|
395
|
+
__commandName: 'COLLECTION_UNION'
|
|
396
|
+
inputs?: Array<
|
|
397
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
398
|
+
| DataCalcInput<'union_by_path', string> /* default: "" */
|
|
399
|
+
| DataCalcInput<
|
|
400
|
+
'iteratee_result_value',
|
|
401
|
+
any
|
|
402
|
+
> /* iteratee callback input */ /* default: undefined */
|
|
403
|
+
>
|
|
404
|
+
outputs?: Array<
|
|
405
|
+
| DataCalcOutput<'iteratee_input'> /* iteratee callback */ /* target: object */
|
|
406
|
+
| DataCalcOutput<'result'> /* target: any */
|
|
407
|
+
>
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/* Without — Creates an array excluding all given values. */
|
|
411
|
+
export type DataCommandCollectionWithout = DataCommand & {
|
|
412
|
+
__commandName: 'COLLECTION_WITHOUT'
|
|
413
|
+
inputs?: Array<
|
|
414
|
+
| DataCalcInput<'array', Array<any>> /* default: [] */
|
|
415
|
+
| DataCalcInput<'exclude', Array<any>> /* default: [] */
|
|
416
|
+
>
|
|
417
|
+
outputs?: Array<DataCalcOutput<'result'> /* target: any */>
|
|
418
|
+
}
|