@uipath/maestro-builder-sdk 6.56.0 → 6.58.0
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/dist/api-index.md +6 -2
- package/dist/api-members.md +1 -1
- package/dist/case/subscription.d.ts +4 -2
- package/dist/case/subscription.js +5 -2
- package/dist/cli/commands/flow.js +2 -0
- package/dist/core/actions.js +2 -2
- package/dist/core/binding-messages.d.ts +2 -1
- package/dist/core/binding-messages.js +3 -4
- package/dist/core/byoa.d.ts +3 -2
- package/dist/core/byoa.js +3 -3
- package/dist/core/carried-definitions.d.ts +0 -18
- package/dist/core/carried-definitions.js +3 -2
- package/dist/core/ceql.d.ts +2 -1
- package/dist/core/ceql.js +3 -2
- package/dist/core/compile-refusal.d.ts +21 -0
- package/dist/core/compile-refusal.js +26 -0
- package/dist/core/connector-inputs.js +2 -1
- package/dist/core/connector-resolve-error.d.ts +2 -1
- package/dist/core/connector-resolve-error.js +3 -4
- package/dist/core/connectors.js +2 -1
- package/dist/core/event-filters.js +2 -1
- package/dist/core/hitl-routing.d.ts +7 -82
- package/dist/core/hitl-routing.js +95 -6
- package/dist/core/library.js +4 -3
- package/dist/core/lookups.js +6 -5
- package/dist/core/nodes/registry.js +3 -2
- package/dist/core/nodes/versioned.js +3 -2
- package/dist/core/process-resource-sort-order.js +1 -1
- package/dist/core/read-text.d.ts +0 -28
- package/dist/core/read-text.js +3 -2
- package/dist/core/refusals.d.ts +465 -0
- package/dist/core/refusals.js +504 -0
- package/dist/core/script-function.d.ts +126 -0
- package/dist/core/script-function.js +511 -0
- package/dist/core/typescript-module.js +2 -1
- package/dist/decompile-cli.js +11 -3
- package/dist/decompile.d.ts +9 -0
- package/dist/decompile.js +76 -3
- package/dist/flow-expr-check.d.ts +2 -1
- package/dist/flow-expr-check.js +4 -2
- package/dist/flow-node-type.d.ts +21 -0
- package/dist/flow-sdk.js +17 -16
- package/dist/flow-step-tree.js +1 -1
- package/dist/flow-variables.js +3 -2
- package/dist/load.js +19 -5
- package/dist/nodes/agent/flow/inline-agent.js +7 -6
- package/dist/nodes/connector/flow/node-type.js +2 -1
- package/dist/nodes/data-fabric/flow/factories.js +2 -1
- package/dist/nodes/data-fabric/flow/verbs.js +2 -1
- package/dist/nodes/delay/flow/factories.js +2 -1
- package/dist/nodes/document/flow/ixp.js +5 -1
- package/dist/nodes/hitl/flow/check.js +4 -2
- package/dist/nodes/hitl/flow/node-type.js +6 -5
- package/dist/nodes/http/flow/factories.js +2 -1
- package/dist/nodes/http/flow/node-type.js +6 -5
- package/dist/nodes/process/flow/factories.js +2 -1
- package/dist/nodes/queue/flow/node-type.js +3 -2
- package/dist/nodes/script/flow/factories.d.ts +42 -1
- package/dist/nodes/script/flow/factories.js +8 -9
- package/dist/nodes/script/flow/node-type.js +71 -0
- package/dist/nodes/script/flow/runtime.d.ts +20 -0
- package/dist/nodes/script/flow/runtime.js +29 -0
- package/dist/nodes/script/flow/spec.d.ts +32 -1
- package/dist/nodes/transform/flow/node-type.js +2 -1
- package/dist/raw-node.js +3 -2
- package/dist/ref-resolve.d.ts +0 -36
- package/dist/ref-resolve.js +9 -8
- package/dist/schema-version.d.ts +0 -38
- package/dist/schema-version.js +3 -2
- package/dist/script-function-scope.d.ts +57 -0
- package/dist/script-function-scope.js +203 -0
- package/dist/sdk-resolve.js +2 -1
- package/dist/serialize.d.ts +5 -2
- package/dist/serialize.js +115 -83
- package/package.json +2 -2
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every diagnostic and refusal code the Flow compile path emits, with its class
|
|
3
|
+
* (docs/CHECK_COMPILE_CONTRACT_DESIGN.md §3.1, #1440):
|
|
4
|
+
*
|
|
5
|
+
* - `lint`: the flow is probably wrong. Only `check` reports it; it never
|
|
6
|
+
* stops `compile` from writing. A serializer warning (`CONNECTION_STUB`) is
|
|
7
|
+
* `lint` too: it never blocks.
|
|
8
|
+
* - `lowering`: `compile` cannot write a correct `.flow`. It always stops
|
|
9
|
+
* `compile`; `check` may report it early.
|
|
10
|
+
* - `draft`: an unfinished canvas node (no connection yet, a required input
|
|
11
|
+
* left empty, a generic operation with no object). These are the codes a
|
|
12
|
+
* draft-tolerant compile collects instead of throwing (`DraftCode` in
|
|
13
|
+
* `serialize.ts`).
|
|
14
|
+
*
|
|
15
|
+
* A class describes the code's ERROR-level emission. A code `check` sometimes
|
|
16
|
+
* reports as a warning (`RAW_NODE_UNKNOWN_INPUT` at a version the SDK does not
|
|
17
|
+
* bundle) never blocks there; a warning never does. A code names ONE
|
|
18
|
+
* condition: when `check` and the serializer report different conditions,
|
|
19
|
+
* they get different codes, so one code never both stops compile and lets it
|
|
20
|
+
* write.
|
|
21
|
+
*
|
|
22
|
+
* The classes record what each code does as it is emitted today. A code that
|
|
23
|
+
* names a condition compile refuses through a still-uncoded throw is `lint`
|
|
24
|
+
* until the slice that codes that throw moves it to `lowering`. Any other move
|
|
25
|
+
* between classes is a behaviour change with its own review (the design doc's
|
|
26
|
+
* §7).
|
|
27
|
+
*
|
|
28
|
+
* Naming, for a new code: the family or concern first (`CONNECTOR_`, `BINDING_`,
|
|
29
|
+
* `EVENT_`, `HITL_`, a node type's `codePrefix` such as `QUEUE_` or `RPA_`),
|
|
30
|
+
* then what is wrong (`_NO_FOLDER`, `_NOT_GUID`, `_UNKNOWN_FIELD`). `DUP_` is a
|
|
31
|
+
* duplicate name.
|
|
32
|
+
*
|
|
33
|
+
* FB017 (`tests/lint/rules/fb017-coded-refusals.ts`) keeps this table and the
|
|
34
|
+
* source in step: every code-shaped string literal in the Flow compile path is
|
|
35
|
+
* a key here, and every key is emitted somewhere. The `<PREFIX>_READ_*` codes
|
|
36
|
+
* of the `codePrefix` node types are composed at run time (`check.ts`
|
|
37
|
+
* `checkDeclaredOutputRead`), so they appear here but not as literals.
|
|
38
|
+
*/
|
|
39
|
+
import { ownEntry } from './own-entry.js';
|
|
40
|
+
/** Every code the Flow compile path emits → its class. Sorted by code. */
|
|
41
|
+
export const REFUSALS = {
|
|
42
|
+
AGENTIC_EMPTY_RETURNS: 'lint',
|
|
43
|
+
AGENTIC_KEY_NOT_KEY: 'lint',
|
|
44
|
+
AGENTIC_LOCAL_FORM_UNVERIFIED: 'lint',
|
|
45
|
+
AGENTIC_LOCAL_HAS_FOLDER: 'lint',
|
|
46
|
+
AGENTIC_LOCAL_NO_PROJECT_ID: 'lint',
|
|
47
|
+
AGENTIC_LOCAL_PROJECT_ID_NOT_GUID: 'lint',
|
|
48
|
+
AGENTIC_NAME_IS_PATH: 'lint',
|
|
49
|
+
AGENTIC_NO_FOLDER: 'lint',
|
|
50
|
+
AGENTIC_NO_KEY: 'lint',
|
|
51
|
+
AGENTIC_NO_NAME: 'lint',
|
|
52
|
+
AGENTIC_READ_NOT_OUTPUT: 'lint',
|
|
53
|
+
AGENTIC_READ_UNKNOWN_FIELD: 'lint',
|
|
54
|
+
AGENTIC_READ_WITHOUT_RETURNS: 'lint',
|
|
55
|
+
AGENTIC_RESERVED_INPUT: 'lint',
|
|
56
|
+
AGENT_CONTEXT_NO_FOLDER_PATH: 'lint',
|
|
57
|
+
AGENT_CONTEXT_NO_ID: 'lowering',
|
|
58
|
+
AGENT_CONTEXT_QUERY_NOT_EXPRESSION: 'lint',
|
|
59
|
+
AGENT_EMPTY_INPUT_FLOOR: 'lint',
|
|
60
|
+
AGENT_EMPTY_RETURNS: 'lint',
|
|
61
|
+
AGENT_KEY_NOT_GUID: 'lint',
|
|
62
|
+
AGENT_LOCAL_NO_PROJECT_ID: 'lint',
|
|
63
|
+
AGENT_LOCAL_PROJECT_ID_NOT_GUID: 'lint',
|
|
64
|
+
AGENT_MEMORY_NOT_AUTHORABLE: 'lint',
|
|
65
|
+
AGENT_MEMORY_VERSION_NO_HANDLE: 'lowering',
|
|
66
|
+
AGENT_NAME_IS_PATH: 'lint',
|
|
67
|
+
AGENT_NO_FOLDER: 'lint',
|
|
68
|
+
AGENT_NO_KEY: 'lint',
|
|
69
|
+
AGENT_NO_NAME: 'lint',
|
|
70
|
+
AGENT_READ_NOT_OUTPUT: 'lint',
|
|
71
|
+
AGENT_READ_UNKNOWN_FIELD: 'lint',
|
|
72
|
+
AGENT_READ_WITHOUT_RETURNS: 'lint',
|
|
73
|
+
AGENT_READ_WRONG_CASE: 'lint',
|
|
74
|
+
APIWF_EMPTY_RETURNS: 'lint',
|
|
75
|
+
APIWF_KEY_NOT_KEY: 'lint',
|
|
76
|
+
APIWF_NAME_IS_PATH: 'lint',
|
|
77
|
+
APIWF_NO_FOLDER: 'lint',
|
|
78
|
+
APIWF_NO_KEY: 'lint',
|
|
79
|
+
APIWF_NO_NAME: 'lint',
|
|
80
|
+
APIWF_READ_NOT_OUTPUT: 'lint',
|
|
81
|
+
APIWF_READ_UNKNOWN_FIELD: 'lint',
|
|
82
|
+
APIWF_READ_WITHOUT_RETURNS: 'lint',
|
|
83
|
+
ARM_SCOPED_OUTPUT_READ: 'lint',
|
|
84
|
+
BINDING_MISSING: 'draft',
|
|
85
|
+
BINDING_PLACEHOLDER_UNRESOLVED: 'draft',
|
|
86
|
+
BINDING_SELF_NAME: 'draft',
|
|
87
|
+
BINDING_UNDECLARED: 'draft',
|
|
88
|
+
BRANCH_CONST_COND: 'lint',
|
|
89
|
+
BREAK_OUTSIDE_LOOP: 'lowering',
|
|
90
|
+
CALL_NO_NUMBER: 'lint',
|
|
91
|
+
CALL_NUMBER_NOT_E164: 'lint',
|
|
92
|
+
CARRIED_DEFINITION_CONFLICT: 'lowering',
|
|
93
|
+
CARRIED_DEFINITION_INVALID: 'lowering',
|
|
94
|
+
CEQL_UNPARSEABLE: 'lowering',
|
|
95
|
+
CONNECTION_CONNECTOR_CONFLICT: 'draft',
|
|
96
|
+
CONNECTION_STUB: 'lint',
|
|
97
|
+
CONNECTOR_IMPORT_NOT_A_FILE: 'lowering',
|
|
98
|
+
CONNECTOR_INPUT: 'lowering',
|
|
99
|
+
CONNECTOR_INPUT_MISSING: 'draft',
|
|
100
|
+
CONNECTOR_LIBRARY_ENTRY_UNREADABLE: 'lowering',
|
|
101
|
+
CONNECTOR_NODE_TYPE_INVALID: 'lowering',
|
|
102
|
+
CONNECTOR_NOT_IN_LIBRARY: 'lowering',
|
|
103
|
+
CONNECTOR_NO_FLOW_DEFINITION: 'lowering',
|
|
104
|
+
CONNECTOR_OBJECT_NOT_GENERIC: 'lowering',
|
|
105
|
+
CONNECTOR_OBJECT_REQUIRED: 'draft',
|
|
106
|
+
CONNECTOR_RESOLVE_FAILED: 'lowering',
|
|
107
|
+
CONTINUE_OUTSIDE_LOOP: 'lowering',
|
|
108
|
+
CONTRIBUTION_BINDING_UNRESOLVED: 'draft',
|
|
109
|
+
CONTRIBUTION_INVALID: 'lowering',
|
|
110
|
+
CONVERSATION_NO_ID: 'lint',
|
|
111
|
+
CONVERSATION_RANGE: 'lint',
|
|
112
|
+
CONV_AGENT_CUSTOM_NO_ID: 'lint',
|
|
113
|
+
CONV_AGENT_NO_MODEL: 'lint',
|
|
114
|
+
CONV_AGENT_NO_PROMPT: 'lint',
|
|
115
|
+
CONV_AGENT_NO_TURN: 'lint',
|
|
116
|
+
CONV_AGENT_SETTINGS_MODE: 'lint',
|
|
117
|
+
CUSTOM_FIELDS_UNPREPARED: 'lint',
|
|
118
|
+
DATAFABRIC_DELETE_HAS_NO_OUTPUT: 'lint',
|
|
119
|
+
DATAFABRIC_EMPTY_SET: 'lint',
|
|
120
|
+
DATAFABRIC_EMPTY_VALUES: 'lint',
|
|
121
|
+
DATAFABRIC_FILTER_BLANK_VALUE: 'lint',
|
|
122
|
+
DATAFABRIC_FOLDER_NO_RESOURCE_KEY: 'lint',
|
|
123
|
+
DATAFABRIC_FROMREAD_MULTIPLE: 'lint',
|
|
124
|
+
DATAFABRIC_FROMREAD_UNKNOWN: 'lint',
|
|
125
|
+
DATAFABRIC_IN_REQUIRES_MULTIPLE: 'lint',
|
|
126
|
+
DATAFABRIC_LIMIT_RANGE: 'lint',
|
|
127
|
+
DATAFABRIC_NO_ENTITY: 'lint',
|
|
128
|
+
DATAFABRIC_QUERY_OPTS_WITHOUT_MULTIPLE: 'lint',
|
|
129
|
+
DATAFABRIC_RECORD_REF: 'lowering',
|
|
130
|
+
DATAFABRIC_RESOURCE_KEY_NO_FOLDER: 'lint',
|
|
131
|
+
DATAFABRIC_RESULT_MODE_VERSION: 'lowering',
|
|
132
|
+
DATAFABRIC_SYSTEM_COLUMN: 'lint',
|
|
133
|
+
DECLARATION_SHAPE: 'lowering',
|
|
134
|
+
DECLARATION_TYPE_UNKNOWN: 'lowering',
|
|
135
|
+
DECOMPILE_NOT_A_NUMBER: 'lowering',
|
|
136
|
+
DECOMPILE_VARIABLES_SHAPE: 'lowering',
|
|
137
|
+
DELAY_CALENDAR: 'lint',
|
|
138
|
+
DELAY_DURATION_XOR_UNTIL: 'lowering',
|
|
139
|
+
DELAY_HAS_NO_OUTPUT: 'lint',
|
|
140
|
+
DELAY_NOT_ISO: 'lint',
|
|
141
|
+
DELAY_NO_DURATION: 'lint',
|
|
142
|
+
DELAY_UNTIL_NOT_ISO: 'lint',
|
|
143
|
+
DELAY_ZERO: 'lint',
|
|
144
|
+
DOCVAL_NO_EXTRACTION: 'lint',
|
|
145
|
+
DOCVAL_RENDER_UNKNOWN: 'lint',
|
|
146
|
+
DOCVAL_TAXONOMY_REQUIRED: 'lint',
|
|
147
|
+
DOC_NO_FILEREF: 'lint',
|
|
148
|
+
DOWHILE_CONST_COND: 'lint',
|
|
149
|
+
DOWHILE_LIMIT: 'lint',
|
|
150
|
+
DUP_CASE: 'lint',
|
|
151
|
+
DUP_END_NAME: 'lowering',
|
|
152
|
+
DUP_STEP: 'lowering',
|
|
153
|
+
EMPTY_ARM: 'lint',
|
|
154
|
+
EMPTY_LOOP: 'lint',
|
|
155
|
+
ENTRY_POINT_DUP_ID: 'lowering',
|
|
156
|
+
ENTRY_POINT_INPUT_COLLISION: 'lint',
|
|
157
|
+
ENTRY_POINT_NO_SHARED_BODY: 'lowering',
|
|
158
|
+
ERROR_ENVELOPE_VIA_OUTPUT: 'lint',
|
|
159
|
+
ERROR_FIELD_UNDECLARED: 'lint',
|
|
160
|
+
ERROR_READ_OUTSIDE_HANDLER: 'lowering',
|
|
161
|
+
ERROR_READ_VIA_OUT: 'lint',
|
|
162
|
+
EVENT_BYOA_UNVERIFIED: 'lowering',
|
|
163
|
+
EVENT_FILTERS_NOT_ARRAY: 'lint',
|
|
164
|
+
EVENT_FILTER_BACKSLASH: 'lowering',
|
|
165
|
+
EVENT_FILTER_BAD_VALUE: 'lowering',
|
|
166
|
+
EVENT_FILTER_MANY_OPERATORS: 'lowering',
|
|
167
|
+
EVENT_FILTER_NO_FIELD: 'lowering',
|
|
168
|
+
EVENT_FILTER_NO_VALUE: 'lowering',
|
|
169
|
+
EVENT_FILTER_UNKNOWN_FIELD: 'lint',
|
|
170
|
+
EVENT_GENERIC_NO_OBJECT: 'lowering',
|
|
171
|
+
EVENT_NO_CONNECTOR: 'lint',
|
|
172
|
+
EVENT_NO_EVENT: 'lint',
|
|
173
|
+
EVENT_NO_SCOPE: 'lint',
|
|
174
|
+
EVENT_NO_SUBSCRIPTION: 'lint',
|
|
175
|
+
EVENT_OBJECT_NOT_GENERIC: 'lint',
|
|
176
|
+
EVENT_SCOPE_NOT_TAKEN: 'lint',
|
|
177
|
+
EVENT_UNKNOWN: 'lowering',
|
|
178
|
+
EVENT_UNPREPARED: 'lint',
|
|
179
|
+
EXPR_SYNTAX: 'lowering',
|
|
180
|
+
EXPR_UNDECLARED_REF: 'lowering',
|
|
181
|
+
EXTRACT_SCHEMA_SHAPE: 'lint',
|
|
182
|
+
FILE_NOT_FOUND: 'lowering',
|
|
183
|
+
FIRE_AND_FORGET_READ: 'lint',
|
|
184
|
+
FIRE_AND_FORGET_RETURNS: 'lowering',
|
|
185
|
+
FLOW_EXPORT_NOT_BUILT: 'lowering',
|
|
186
|
+
FLOW_NO_DEFAULT_EXPORT: 'lowering',
|
|
187
|
+
FLOW_SOURCE_NOT_FOUND: 'lowering',
|
|
188
|
+
FORM_TRIGGER_NO_INPUTS: 'lint',
|
|
189
|
+
FUNCTION_EMPTY_RETURNS: 'lint',
|
|
190
|
+
FUNCTION_KEY_NOT_KEY: 'lint',
|
|
191
|
+
FUNCTION_NAME_IS_PATH: 'lint',
|
|
192
|
+
FUNCTION_NO_FOLDER: 'lint',
|
|
193
|
+
FUNCTION_NO_KEY: 'lint',
|
|
194
|
+
FUNCTION_NO_NAME: 'lint',
|
|
195
|
+
FUNCTION_READ_NOT_OUTPUT: 'lint',
|
|
196
|
+
FUNCTION_READ_UNKNOWN_FIELD: 'lint',
|
|
197
|
+
FUNCTION_READ_WITHOUT_RETURNS: 'lint',
|
|
198
|
+
GUARDRAIL_ACTION_UNKNOWN: 'lint',
|
|
199
|
+
GUARDRAIL_DUP_ID: 'lint',
|
|
200
|
+
GUARDRAIL_INCOMPLETE: 'lint',
|
|
201
|
+
GUARDRAIL_NO_RULES: 'lint',
|
|
202
|
+
GUARDRAIL_NO_SCOPE: 'lint',
|
|
203
|
+
GUARDRAIL_NO_VALIDATOR: 'lint',
|
|
204
|
+
GUARDRAIL_TYPE_UNKNOWN: 'lint',
|
|
205
|
+
HITL_APP_INCOMPLETE: 'lint',
|
|
206
|
+
HITL_APP_MISSING: 'lint',
|
|
207
|
+
HITL_APP_WITHOUT_VARIANT: 'lint',
|
|
208
|
+
HITL_APP_WITH_FIELDS: 'lint',
|
|
209
|
+
HITL_CHANNEL_UNKNOWN: 'lint',
|
|
210
|
+
HITL_COMPLETED_PORT_GONE: 'lowering',
|
|
211
|
+
HITL_DOCUMENT_WITHOUT_VARIANT: 'lint',
|
|
212
|
+
HITL_DOCVAL_NO_DOCUMENT: 'lint',
|
|
213
|
+
HITL_DOCVAL_WITH_FIELDS: 'lint',
|
|
214
|
+
HITL_DUP_FIELD: 'lint',
|
|
215
|
+
HITL_DUP_OUTCOME: 'lint',
|
|
216
|
+
HITL_DUP_OUTCOME_ID: 'lint',
|
|
217
|
+
HITL_END_OUTCOME_IN_PARALLEL: 'lowering',
|
|
218
|
+
HITL_EXPOSE_ERROR_VERSION: 'lowering',
|
|
219
|
+
HITL_FAN_OUT_INTO_JOIN: 'lowering',
|
|
220
|
+
HITL_FIELD_DIRECTION: 'lint',
|
|
221
|
+
HITL_FIELD_NO_ID: 'lint',
|
|
222
|
+
HITL_FIELD_NO_VALUE: 'lint',
|
|
223
|
+
HITL_FIELD_OPTIONS: 'lint',
|
|
224
|
+
HITL_FIELD_OPTIONS_IGNORED: 'lint',
|
|
225
|
+
HITL_FIELD_RESERVED_ID: 'lint',
|
|
226
|
+
HITL_FIELD_SETTING_INVALID: 'lint',
|
|
227
|
+
HITL_FIELD_TYPE_UNKNOWN: 'lint',
|
|
228
|
+
HITL_FIELD_VALUE_NOT_PATH: 'lint',
|
|
229
|
+
HITL_FIELD_VALUE_NOT_REF: 'lint',
|
|
230
|
+
HITL_FIELD_VARIABLE: 'lint',
|
|
231
|
+
HITL_LEGACY_COMPLETED: 'lint',
|
|
232
|
+
HITL_LEGACY_COMPLETED_CONFLICT: 'lowering',
|
|
233
|
+
HITL_LEGACY_COMPLETED_NO_EFFECT: 'lint',
|
|
234
|
+
HITL_LEGACY_COMPLETED_VERSION: 'lowering',
|
|
235
|
+
HITL_NO_FIELDS: 'lint',
|
|
236
|
+
HITL_NO_OUTCOMES: 'lint',
|
|
237
|
+
HITL_OUTCOMES_UNREACHABLE: 'lint',
|
|
238
|
+
HITL_OUTCOME_ACTION: 'lint',
|
|
239
|
+
HITL_OUTCOME_BAD_ID: 'lint',
|
|
240
|
+
HITL_OUTCOME_NO_NAME: 'lint',
|
|
241
|
+
HITL_OUTCOME_PORTS_OFF: 'lowering',
|
|
242
|
+
HITL_OUTCOME_PORTS_VARIANT: 'lowering',
|
|
243
|
+
HITL_OUTCOME_PORT_MISPLACED: 'lint',
|
|
244
|
+
HITL_OUTCOME_PORT_UNKNOWN: 'lowering',
|
|
245
|
+
HITL_OUTCOME_UNROUTED: 'lint',
|
|
246
|
+
HITL_PORT_ALREADY_WIRED: 'lowering',
|
|
247
|
+
HITL_READ_NOT_OUTPUT: 'lint',
|
|
248
|
+
HITL_READ_STATUS: 'lint',
|
|
249
|
+
HITL_READ_UNKNOWN_FIELD: 'lint',
|
|
250
|
+
HITL_RECIPIENT_TYPE: 'lint',
|
|
251
|
+
HITL_RECIPIENT_VALUE: 'lint',
|
|
252
|
+
HITL_UNREACHABLE_AFTER: 'lint',
|
|
253
|
+
HITL_VARIANT_UNKNOWN: 'lint',
|
|
254
|
+
HTTP_BINDING_REQUIRES_MANAGED: 'lowering',
|
|
255
|
+
HTTP_BRANCH_CONST: 'lint',
|
|
256
|
+
HTTP_BRANCH_DUP: 'lint',
|
|
257
|
+
HTTP_BRANCH_NAME: 'lint',
|
|
258
|
+
HTTP_BRANCH_UNKNOWN: 'lint',
|
|
259
|
+
HTTP_MANAGED_BINDING_INCOMPLETE: 'lowering',
|
|
260
|
+
HTTP_MANAGED_REQUIRED: 'lowering',
|
|
261
|
+
HTTP_ONERROR_V1: 'lint',
|
|
262
|
+
HTTP_READ_NOT_OUTPUT: 'lint',
|
|
263
|
+
HTTP_READ_UNKNOWN_FIELD: 'lint',
|
|
264
|
+
HTTP_READ_WITHOUT_RETURNS: 'lint',
|
|
265
|
+
HTTP_RETRY_COUNT_HIGH: 'lint',
|
|
266
|
+
HTTP_RETRY_COUNT_INVALID: 'lint',
|
|
267
|
+
HTTP_TARGET_CONNECTOR_EMPTY: 'lowering',
|
|
268
|
+
HTTP_TARGET_CONNECTOR_REQUIRES_BINDING: 'lowering',
|
|
269
|
+
HTTP_TIMEOUT_NOT_DURATION: 'lint',
|
|
270
|
+
HTTP_V1_RETIRED: 'lint',
|
|
271
|
+
INLINE_AGENT_COMPOSITE_INPUT: 'lint',
|
|
272
|
+
INLINE_AGENT_EMPTY_RETURNS: 'lint',
|
|
273
|
+
INLINE_AGENT_ESCALATION_APP_KEY_NOT_GUID: 'lint',
|
|
274
|
+
INLINE_AGENT_ESCALATION_APP_WITH_FIELDS: 'lint',
|
|
275
|
+
INLINE_AGENT_ESCALATION_FIELD_OPTIONS: 'lint',
|
|
276
|
+
INLINE_AGENT_ESCALATION_FIELD_OPTIONS_IGNORED: 'lint',
|
|
277
|
+
INLINE_AGENT_ESCALATION_FIELD_SETTING_INVALID: 'lint',
|
|
278
|
+
INLINE_AGENT_ESCALATION_FIELD_TYPE_UNKNOWN: 'lint',
|
|
279
|
+
INLINE_AGENT_ESCALATION_NO_APP: 'lint',
|
|
280
|
+
INLINE_AGENT_ESCALATION_NO_FIELDS: 'lint',
|
|
281
|
+
INLINE_AGENT_ESCALATION_NO_NAME: 'lint',
|
|
282
|
+
INLINE_AGENT_ESCALATION_QUICKFORM_WITH_APP: 'lint',
|
|
283
|
+
INLINE_AGENT_ESCALATION_VARIANT: 'lint',
|
|
284
|
+
INLINE_AGENT_INPUT_NAME_AMBIGUOUS: 'lint',
|
|
285
|
+
INLINE_AGENT_MEMORY_ID_NOT_GUID: 'lint',
|
|
286
|
+
INLINE_AGENT_MEMORY_INCOMPLETE: 'lint',
|
|
287
|
+
INLINE_AGENT_NO_MODEL: 'lint',
|
|
288
|
+
INLINE_AGENT_NO_SYSTEM_PROMPT: 'lint',
|
|
289
|
+
INLINE_AGENT_NO_USER_PROMPT: 'lint',
|
|
290
|
+
INLINE_AGENT_PROMPT_JSON_TEXT: 'lint',
|
|
291
|
+
INLINE_AGENT_READ_NOT_OUTPUT: 'lint',
|
|
292
|
+
INLINE_AGENT_READ_UNKNOWN_FIELD: 'lint',
|
|
293
|
+
INLINE_AGENT_RESOURCE_NODE_ID: 'lowering',
|
|
294
|
+
INLINE_AGENT_RESOURCE_SOURCE_DUP: 'lowering',
|
|
295
|
+
INLINE_AGENT_RESOURCE_SOURCE_NOT_GUID: 'lint',
|
|
296
|
+
INLINE_AGENT_SCAFFOLD_MODEL: 'lint',
|
|
297
|
+
INLINE_AGENT_SOURCE_NOT_GUID: 'lint',
|
|
298
|
+
INLINE_AGENT_TOOL_A2A_INCOMPLETE: 'lint',
|
|
299
|
+
INLINE_AGENT_TOOL_CLIENTSIDE_NO_NAME: 'lint',
|
|
300
|
+
INLINE_AGENT_TOOL_CONNECTOR_NO_CONNECTION: 'lint',
|
|
301
|
+
INLINE_AGENT_TOOL_HTTP_METHOD: 'lint',
|
|
302
|
+
INLINE_AGENT_TOOL_IXP_NO_NAME: 'lint',
|
|
303
|
+
INLINE_AGENT_TOOL_IXP_PROJECT_NOT_GUID: 'lint',
|
|
304
|
+
INLINE_AGENT_TOOL_KEY_NOT_GUID: 'lint',
|
|
305
|
+
INLINE_AGENT_TOOL_MCP_INCOMPLETE: 'lint',
|
|
306
|
+
INLINE_AGENT_TOOL_NO_OPERATION: 'lint',
|
|
307
|
+
INLINE_AGENT_TOOL_NO_RESOURCE_ID: 'lint',
|
|
308
|
+
INLINE_AGENT_TOOL_UNKNOWN_BUILTIN: 'lowering',
|
|
309
|
+
INLINE_AGENT_TOOL_UNKNOWN_KIND: 'lowering',
|
|
310
|
+
INLINE_AGENT_UNDECLARED_PLACEHOLDER: 'lint',
|
|
311
|
+
INLINE_AGENT_UNREFERENCED_INPUT: 'lint',
|
|
312
|
+
INPUT_READ_WITHOUT_TRIGGER: 'lint',
|
|
313
|
+
IXP_FORBIDDEN_INPUT: 'lint',
|
|
314
|
+
IXP_NO_FILE: 'lint',
|
|
315
|
+
IXP_NO_FOLDER: 'lint',
|
|
316
|
+
IXP_NO_MODEL_NAME: 'lint',
|
|
317
|
+
IXP_NO_NAME: 'lint',
|
|
318
|
+
IXP_NO_PROJECT: 'lowering',
|
|
319
|
+
IXP_PROJECT_NOT_NODE_TYPE: 'lowering',
|
|
320
|
+
IXP_PROJECT_TAIL_UNPARSEABLE: 'lowering',
|
|
321
|
+
JSON_REF_CIRCULAR: 'lowering',
|
|
322
|
+
JSON_REF_NOT_JSON: 'lowering',
|
|
323
|
+
JSON_REF_PATH_INVALID: 'lowering',
|
|
324
|
+
JSON_REF_TOO_DEEP: 'lowering',
|
|
325
|
+
JSON_REF_UNREADABLE: 'lowering',
|
|
326
|
+
JS_ESCAPE_COOKED: 'lint',
|
|
327
|
+
JS_ESCAPE_INVALID: 'lint',
|
|
328
|
+
LAYOUT_EDGE_AMBIGUOUS: 'lowering',
|
|
329
|
+
LAYOUT_EDGE_KEY_FORM: 'lowering',
|
|
330
|
+
LAYOUT_UNKNOWN_KEY: 'lowering',
|
|
331
|
+
LIBRARY_NOT_FOUND: 'lowering',
|
|
332
|
+
LIBRARY_REQUIRED: 'lowering',
|
|
333
|
+
LIST_OUTPUT_WRAPPER: 'lint',
|
|
334
|
+
LOOKUP_ARGS: 'lowering',
|
|
335
|
+
LOOKUP_LITERAL_ID: 'lint',
|
|
336
|
+
LOOKUP_MISPLACED: 'lowering',
|
|
337
|
+
LOOKUP_RUNTIME_VALUE: 'lint',
|
|
338
|
+
LOOKUP_UNKNOWN_ALIAS: 'lowering',
|
|
339
|
+
LOOKUP_UNKNOWN_FIELD: 'lowering',
|
|
340
|
+
LOOKUP_UNKNOWN_MATCH_KEY: 'lowering',
|
|
341
|
+
LOOKUP_UNRESOLVED: 'lowering',
|
|
342
|
+
LOOP_EXIT_IN_PARALLEL_ARM: 'lint',
|
|
343
|
+
LOOP_EXIT_UNREACHABLE_AFTER: 'lint',
|
|
344
|
+
LOOP_PARALLEL_LEGACY: 'lint',
|
|
345
|
+
LOOP_VERSION_UNSUPPORTED: 'lowering',
|
|
346
|
+
MOCK_HAS_NO_OUTPUT: 'lint',
|
|
347
|
+
NODE_FAMILY_REGISTRATION: 'lowering',
|
|
348
|
+
NODE_VERSION_UNREGISTERED: 'lowering',
|
|
349
|
+
NO_ID: 'lint',
|
|
350
|
+
NO_RETURN: 'lint',
|
|
351
|
+
OBJECT_UNPREPARED: 'lint',
|
|
352
|
+
ONERROR_NO_ERROR_PORT: 'lowering',
|
|
353
|
+
OUTPUT_BACKING_COLLISION: 'lowering',
|
|
354
|
+
OUTPUT_TYPE_MISMATCH: 'lint',
|
|
355
|
+
OUTPUT_VAR_MISMATCH: 'lowering',
|
|
356
|
+
PACKAGE_NODES_NOT_PLATFORM: 'lint',
|
|
357
|
+
PARALLEL_ARM_RETURNS: 'lint',
|
|
358
|
+
PARALLEL_EMPTY_ARM: 'lint',
|
|
359
|
+
PARALLEL_FORK_ALTERNATIVES: 'lowering',
|
|
360
|
+
PARALLEL_HAS_NO_OUTPUT: 'lint',
|
|
361
|
+
PARALLEL_REF_JOIN: 'lint',
|
|
362
|
+
PARALLEL_TOO_FEW_ARMS: 'lint',
|
|
363
|
+
PORT_ALREADY_ROUTED: 'lowering',
|
|
364
|
+
PORT_EMPTY_PATH: 'lowering',
|
|
365
|
+
PORT_NO_SOURCE_STEP: 'lowering',
|
|
366
|
+
QUEUE_BAD_DATE: 'lint',
|
|
367
|
+
QUEUE_BAD_PRIORITY: 'lint',
|
|
368
|
+
QUEUE_ITEM_EXPR_UNSUPPORTED: 'lowering',
|
|
369
|
+
QUEUE_ITEM_FIELD_NOT_PRIMITIVE: 'lint',
|
|
370
|
+
QUEUE_ITEM_NOT_OBJECT: 'lint',
|
|
371
|
+
QUEUE_KEY_NOT_GUID: 'lint',
|
|
372
|
+
QUEUE_NO_FOLDER: 'lint',
|
|
373
|
+
QUEUE_NO_ITEM: 'lint',
|
|
374
|
+
QUEUE_NO_KEY: 'lint',
|
|
375
|
+
QUEUE_NO_NAME: 'lint',
|
|
376
|
+
QUEUE_READ_NOT_OUTPUT: 'lint',
|
|
377
|
+
QUEUE_READ_UNKNOWN_FIELD: 'lint',
|
|
378
|
+
QUEUE_READ_WITHOUT_RETURNS: 'lint',
|
|
379
|
+
QUEUE_RETURNS_WITHOUT_WAIT: 'lint',
|
|
380
|
+
RAW_NODE_CONNECTOR: 'lowering',
|
|
381
|
+
RAW_NODE_TYPED_FAMILY: 'lint',
|
|
382
|
+
RAW_NODE_UNKNOWN_INPUT: 'lowering',
|
|
383
|
+
RAW_NODE_VERSION_MISMATCH: 'lowering',
|
|
384
|
+
READ_TEXT_UNAVAILABLE: 'lowering',
|
|
385
|
+
REF_INTO_LOOP: 'lint',
|
|
386
|
+
REF_INTO_PARALLEL_ARM: 'lint',
|
|
387
|
+
REF_INTO_PORT_LIST: 'lint',
|
|
388
|
+
REF_OUT_OF_LOOP: 'lint',
|
|
389
|
+
REF_OUT_OF_PARALLEL_ARM: 'lint',
|
|
390
|
+
REF_TARGET_NOT_NAME: 'lowering',
|
|
391
|
+
REF_TO_OWN_LOOP: 'lint',
|
|
392
|
+
REF_UNKNOWN_TARGET: 'lowering',
|
|
393
|
+
REF_UNREACHABLE_AFTER: 'lint',
|
|
394
|
+
RETURN_UPDATES_SAME_VAR: 'lowering',
|
|
395
|
+
RPA_KEY_NOT_KEY: 'lint',
|
|
396
|
+
RPA_LOCAL_HAS_FOLDER: 'lint',
|
|
397
|
+
RPA_LOCAL_NO_PROJECT_ID: 'lint',
|
|
398
|
+
RPA_LOCAL_PROJECT_ID_NOT_GUID: 'lint',
|
|
399
|
+
RPA_NAME_IS_PATH: 'lint',
|
|
400
|
+
RPA_NO_FOLDER: 'lint',
|
|
401
|
+
RPA_NO_KEY: 'lint',
|
|
402
|
+
RPA_NO_NAME: 'lint',
|
|
403
|
+
RPA_READ_NOT_OUTPUT: 'lint',
|
|
404
|
+
RPA_READ_UNKNOWN_FIELD: 'lint',
|
|
405
|
+
RPA_READ_WITHOUT_RETURNS: 'lint',
|
|
406
|
+
SCHEDULE_CRON_VERSION: 'lowering',
|
|
407
|
+
SCHEDULE_NEVER_FIRES: 'lint',
|
|
408
|
+
SCHEDULE_NOT_ISO: 'lint',
|
|
409
|
+
SCHEDULE_NO_INTERVAL: 'lint',
|
|
410
|
+
SCHEMA_VERSION_ABOVE_FLOOR: 'lint',
|
|
411
|
+
SCHEMA_VERSION_BELOW_FLOOR: 'lint',
|
|
412
|
+
SCHEMA_VERSION_ON_SUBFLOW: 'lint',
|
|
413
|
+
SCHEMA_VERSION_UNSUPPORTED: 'lowering',
|
|
414
|
+
SCRIPT_EMPTY_RETURNS: 'lint',
|
|
415
|
+
SCRIPT_FUNCTION_SCOPE: 'lowering',
|
|
416
|
+
SCRIPT_FUNCTION_UNLOWERABLE: 'lowering',
|
|
417
|
+
SCRIPT_RETURNS_UNKNOWN_TYPE: 'lint',
|
|
418
|
+
SDK_RESOLVE_HOOK_MISSING: 'lowering',
|
|
419
|
+
SEND_MESSAGE_NO_CONTENT: 'lint',
|
|
420
|
+
SEND_MESSAGE_NO_EXCHANGE: 'lint',
|
|
421
|
+
SHARED_INPUT_IN_SUBFLOW: 'lowering',
|
|
422
|
+
SHARED_INPUT_NAME_INVALID: 'lowering',
|
|
423
|
+
SHARED_INPUT_NOT_INPUT: 'lowering',
|
|
424
|
+
SHARED_INPUT_ROOT_MISSING: 'lint',
|
|
425
|
+
SHARED_INPUT_SAME_ROOT: 'lowering',
|
|
426
|
+
SHARED_INPUT_TARGET_IS_INPUT: 'lowering',
|
|
427
|
+
SHARED_INPUT_TYPE_MISMATCH: 'lowering',
|
|
428
|
+
SINGLE_CONVERSATION_TRIGGER: 'lint',
|
|
429
|
+
STEP_ID_COLLISION: 'lowering',
|
|
430
|
+
STEP_NOT_ACTION: 'lowering',
|
|
431
|
+
STEP_READ_WITHOUT_OUTPUT: 'lint',
|
|
432
|
+
STEP_SWITCH_ARM_LABEL: 'lowering',
|
|
433
|
+
STEP_SWITCH_EXIT_DUP: 'lint',
|
|
434
|
+
STEP_SWITCH_EXIT_UNKNOWN: 'lowering',
|
|
435
|
+
STEP_SWITCH_EXIT_UNROUTED: 'lint',
|
|
436
|
+
STEP_SWITCH_NO_ARMS: 'lowering',
|
|
437
|
+
STEP_SWITCH_NO_EXITS: 'lowering',
|
|
438
|
+
STICKY_NOTE_DUP_ID: 'lowering',
|
|
439
|
+
STICKY_NOTE_ID_TAKEN: 'lowering',
|
|
440
|
+
STICKY_NOTE_NO_CONTENT: 'lowering',
|
|
441
|
+
STICKY_NOTE_POSITION: 'lowering',
|
|
442
|
+
STICKY_NOTE_SIZE: 'lowering',
|
|
443
|
+
SUBFLOW_CHILD_TRIGGER: 'lint',
|
|
444
|
+
SUBFLOW_CYCLE: 'lint',
|
|
445
|
+
SUBFLOW_HAS_NO_OUTPUT: 'lint',
|
|
446
|
+
SUBFLOW_MISSING_INPUT: 'lint',
|
|
447
|
+
SUBFLOW_NO_CHILD: 'lint',
|
|
448
|
+
SUBFLOW_OUTPUT_NEVER_RETURNED: 'lint',
|
|
449
|
+
SUBFLOW_OUTPUT_NO_FIELD: 'lint',
|
|
450
|
+
SUBFLOW_UNKNOWN_INPUT: 'lint',
|
|
451
|
+
SUBFLOW_UNKNOWN_OUTPUT: 'lint',
|
|
452
|
+
SWITCH_CASE_FORM: 'lint',
|
|
453
|
+
SWITCH_CASE_ID: 'lint',
|
|
454
|
+
SWITCH_CASE_TYPE_MISMATCH: 'lint',
|
|
455
|
+
SWITCH_CONST_ON: 'lint',
|
|
456
|
+
SWITCH_CONST_WHEN: 'lint',
|
|
457
|
+
SWITCH_HAS_NO_OUTPUT: 'lint',
|
|
458
|
+
SWITCH_NO_CASES: 'lint',
|
|
459
|
+
SWITCH_ON_UNUSED: 'lint',
|
|
460
|
+
TEMPLATED_EXITS_ONLY: 'lowering',
|
|
461
|
+
TERMINATE_HAS_NO_OUTPUT: 'lint',
|
|
462
|
+
TERMINATE_NOT_ARM_HEAD: 'lint',
|
|
463
|
+
TERMINATE_UNREACHABLE_AFTER: 'lint',
|
|
464
|
+
TRANSFORM_AGG_NO_ALIAS: 'lint',
|
|
465
|
+
TRANSFORM_AGG_NO_FIELD: 'lint',
|
|
466
|
+
TRANSFORM_BAD_VOCAB: 'lint',
|
|
467
|
+
TRANSFORM_COLLECTION_LITERAL: 'lint',
|
|
468
|
+
TRANSFORM_COLLECTION_NOT_PATH: 'lint',
|
|
469
|
+
TRANSFORM_COLLECTION_NOT_REF: 'lint',
|
|
470
|
+
TRANSFORM_COLLECTION_SCALAR: 'lint',
|
|
471
|
+
TRANSFORM_CONTAINS_ARRAY_VALUE: 'lint',
|
|
472
|
+
TRANSFORM_EMPTY_FILTER: 'lint',
|
|
473
|
+
TRANSFORM_EMPTY_MAP: 'lint',
|
|
474
|
+
TRANSFORM_FILTER_NO_FIELD: 'lint',
|
|
475
|
+
TRANSFORM_FILTER_VALUE_EXPR: 'lint',
|
|
476
|
+
TRANSFORM_MAP_NO_FIELD: 'lint',
|
|
477
|
+
TRANSFORM_NO_COLLECTION: 'lint',
|
|
478
|
+
TRANSFORM_NO_GROUP_FIELD: 'lint',
|
|
479
|
+
TRANSFORM_NO_OPERATIONS: 'lint',
|
|
480
|
+
TRANSFORM_UNKNOWN_OP: 'lint',
|
|
481
|
+
TRANSFORM_VARIANT_ONE_OP: 'lint',
|
|
482
|
+
TRANSFORM_VARIANT_OP_MISMATCH: 'lint',
|
|
483
|
+
TRANSFORM_VARIANT_UNKNOWN: 'lowering',
|
|
484
|
+
TRIGGER_INPUTS_IGNORED: 'lint',
|
|
485
|
+
TRIGGER_UNKNOWN_KIND: 'lowering',
|
|
486
|
+
TYPESCRIPT_UNAVAILABLE: 'lowering',
|
|
487
|
+
UNKNOWN_LOOP_FIELD: 'lint',
|
|
488
|
+
UNKNOWN_REF: 'lint',
|
|
489
|
+
UPDATES_NOT_SUPPORTED: 'lowering',
|
|
490
|
+
UPDATE_INPUT_READONLY: 'lint',
|
|
491
|
+
UPDATE_UNKNOWN_VAR: 'lint',
|
|
492
|
+
VARIABLE_NAME_COLLISION: 'lowering',
|
|
493
|
+
VARS_BRACKET_READ: 'lint',
|
|
494
|
+
VOICE_AGENT_ITERATIONS: 'lint',
|
|
495
|
+
VOICE_AGENT_NO_PROMPT: 'lint',
|
|
496
|
+
VOICE_CALL_CONTEXT_NOT_OBJECT: 'lint',
|
|
497
|
+
VOICE_MODEL_UNKNOWN: 'lint',
|
|
498
|
+
VOICE_NO_CALL_CONTEXT: 'lint',
|
|
499
|
+
VOICE_PERSONA_UNKNOWN: 'lint',
|
|
500
|
+
};
|
|
501
|
+
/** The class of `code`, or `undefined` for a code the table does not list. */
|
|
502
|
+
export function refusalClass(code) {
|
|
503
|
+
return ownEntry(REFUSALS, code);
|
|
504
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/script-function — a TypeScript function lowered to a script body.
|
|
3
|
+
*
|
|
4
|
+
* A script body is a string the editor and tsc never see. Authoring it as a
|
|
5
|
+
* function lets the compiler check it like the rest of the module, and this file
|
|
6
|
+
* turns that function back into the body a script node carries
|
|
7
|
+
* (docs/SCRIPT_FUNCTION_DESIGN.md).
|
|
8
|
+
*
|
|
9
|
+
* The body is kept EXACTLY as `Function.prototype.toString()` returned it: the
|
|
10
|
+
* artifact goes to a designer, and the author expects to see the script they
|
|
11
|
+
* wrote. Only two edits are made, both because the runtime requires them:
|
|
12
|
+
*
|
|
13
|
+
* 1. the parameter is renamed to the runtime's own scope global (`$vars` in
|
|
14
|
+
* Flow). The parameter is an authoring-time name for that global; the SDK
|
|
15
|
+
* never calls the function or passes it anything.
|
|
16
|
+
* 2. esbuild's `keepNames` wrappers (`__name(fn, "fn")`) are removed. A loader
|
|
17
|
+
* such as tsx adds them, and the script runtime has no `__name`.
|
|
18
|
+
*
|
|
19
|
+
* Everything else that would make the lowered body behave differently from the
|
|
20
|
+
* function is refused rather than rewritten: a name the runtime does not
|
|
21
|
+
* provide, a `$vars` binding that would capture the rename, a destructured
|
|
22
|
+
* parameter whose step reads `renameRefs` could not see, a reference to the
|
|
23
|
+
* function's own name, which only the body loses.
|
|
24
|
+
*
|
|
25
|
+
* Names are resolved with the checker of a one-file program over the function's
|
|
26
|
+
* source, not by text: `a.vars`, `{ vars: 1 }` and an inner `(vars) => …` are
|
|
27
|
+
* not references to the parameter, and only a checker knows that.
|
|
28
|
+
*/
|
|
29
|
+
import type * as TS from 'typescript';
|
|
30
|
+
/** How a runtime receives a lowered script: its scope global, and every other name it provides. */
|
|
31
|
+
export interface ScriptRuntime {
|
|
32
|
+
/** The identifier the runtime binds the variable scope to (`$vars` in Flow). */
|
|
33
|
+
scopeGlobal: string;
|
|
34
|
+
/** Every other global name the runtime provides: the language built-ins it has, `console`. */
|
|
35
|
+
globals: ReadonlySet<string>;
|
|
36
|
+
/** How errors name the runtime: `the Flow script runtime`. */
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
/** A function, or its source text, as `Function.prototype.toString()` returns it. */
|
|
40
|
+
export type ScriptFunctionSource = ((...args: never[]) => unknown) | string;
|
|
41
|
+
/**
|
|
42
|
+
* The body a script node carries for `fn`, or a thrown error naming every
|
|
43
|
+
* reason it cannot be one.
|
|
44
|
+
*
|
|
45
|
+
* @param fn - The function, or its source text (what `fn.toString()` returns).
|
|
46
|
+
* @param runtime - The runtime the body will run in.
|
|
47
|
+
* @param label - How errors name the call, e.g. `script(parseMessage)`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function lowerScriptFunction(fn: ScriptFunctionSource, runtime: ScriptRuntime, label?: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* The source of every function {@link lowerScriptFunction} has lowered in this
|
|
52
|
+
* process, in order, one entry per call.
|
|
53
|
+
*
|
|
54
|
+
* The CLIs that load a `.flow.ts` take the entries added while it imported,
|
|
55
|
+
* twice over: to decide whether the module-scope pass
|
|
56
|
+
* (`script-function-scope.ts`) has anything to look at, so a flow with no
|
|
57
|
+
* function scripts pays nothing for it; and to fail closed, by matching each
|
|
58
|
+
* lowered text to a declaration that pass followed, so a function it could not
|
|
59
|
+
* see is refused. Taken per load because one process may load two sources
|
|
60
|
+
* (`merge --baseline-from`).
|
|
61
|
+
*/
|
|
62
|
+
export declare function scriptFunctionLowerings(): readonly string[];
|
|
63
|
+
/** Options for {@link tryLowerScriptFunction}. */
|
|
64
|
+
export interface LowerOptions {
|
|
65
|
+
/**
|
|
66
|
+
* Refuse any use of the parameter other than a dotted read (`vars.start…`):
|
|
67
|
+
* an alias (`const v = vars`), a computed read (`vars['start']`), an optional
|
|
68
|
+
* read (`vars?.start`), or passing it on (`pick(vars)`, `{ vars }`) each hides
|
|
69
|
+
* the step it reads from `renameRefs` and the reference check, which see only
|
|
70
|
+
* `$vars.<name>`. Authoring (`script(fn)`) sets it; decompile's gate does not,
|
|
71
|
+
* because there the text is the node's own either way.
|
|
72
|
+
*/
|
|
73
|
+
scopeReadsOnly?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** What lowering a function's source produced: its body, or every problem with it. */
|
|
76
|
+
export type LoweredScript = {
|
|
77
|
+
ok: true;
|
|
78
|
+
code: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* `free` is the names the runtime would not have, also described in `problems`;
|
|
82
|
+
* `syntax` is set when the source did not parse as one function at all.
|
|
83
|
+
*/
|
|
84
|
+
| {
|
|
85
|
+
ok: false;
|
|
86
|
+
problems: string[];
|
|
87
|
+
free: string[];
|
|
88
|
+
syntax?: true;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* {@link lowerScriptFunction} without the throw, for a caller that falls back
|
|
92
|
+
* when the source cannot be lowered (decompile's function-form gate).
|
|
93
|
+
*/
|
|
94
|
+
export declare function tryLowerScriptFunction(source: string, runtime: ScriptRuntime, options?: LowerOptions): LoweredScript;
|
|
95
|
+
/**
|
|
96
|
+
* The first syntax error in a script BODY (the text a script node carries), as
|
|
97
|
+
* `line N: message`, or undefined when it parses. Lines are the body's own.
|
|
98
|
+
*/
|
|
99
|
+
export declare function scriptBodySyntaxError(code: string): string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* The JavaScript engine's early error for a body run as
|
|
102
|
+
* `function (<scopeGlobal>) { "use strict"; <code> }`, or undefined when it has
|
|
103
|
+
* none.
|
|
104
|
+
*
|
|
105
|
+
* TypeScript's parser does not report early errors (a duplicate `let`, a
|
|
106
|
+
* `const $vars` that clashes with the parameter, an octal literal in strict
|
|
107
|
+
* code), and the printed function lives in an ES module, which is strict. A body
|
|
108
|
+
* with one would make the whole module unloadable, so decompile asks the engine.
|
|
109
|
+
* The body is compiled, never called. A host without the `Function`
|
|
110
|
+
* constructor (a strict content-security policy) cannot answer, which is
|
|
111
|
+
* reported as an error too, so the caller keeps the string form.
|
|
112
|
+
*/
|
|
113
|
+
export declare function scriptBodyEarlyError(code: string, runtime: ScriptRuntime): string | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* The first piece of TypeScript-only syntax in a body, described, or undefined.
|
|
116
|
+
*
|
|
117
|
+
* A string body is JavaScript, but the printed function is read by a TypeScript
|
|
118
|
+
* loader, which erases type syntax before the runtime ever sees it: a body with
|
|
119
|
+
* `const n: number = 1` would come back from compile as `const n = 1`,
|
|
120
|
+
* and `f<T>(x)`, which JavaScript reads as two comparisons, would come back as a
|
|
121
|
+
* call. Either silently changes the stored script, so such a body keeps the
|
|
122
|
+
* string form.
|
|
123
|
+
*/
|
|
124
|
+
export declare function scriptBodyTypeScriptSyntax(code: string): string | undefined;
|
|
125
|
+
/** Whether `id` is read as a value, not a property name, label, or type. */
|
|
126
|
+
export declare function isReference(ts: typeof TS, id: TS.Identifier): boolean;
|