@uipath/maestro-builder-sdk 6.87.0 → 6.87.2
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/README.md +2 -0
- package/dist/api-index.md +11 -5
- package/dist/api-members.md +31 -21
- package/dist/bpmn/check-cli.js +38 -7
- package/dist/bpmn/source-types.d.ts +17 -0
- package/dist/bpmn/source-types.js +136 -0
- package/dist/bpmn-api.md +1201 -0
- package/dist/cli/commands/bpmn.js +3 -0
- package/dist/decompile.js +3 -1
- package/dist/nodes/document/flow/node-type.js +69 -0
- package/dist/nodes/document/flow/spec.d.ts +35 -0
- package/dist/script-function-scope.d.ts +38 -0
- package/dist/script-function-scope.js +1 -1
- package/dist/serialize.js +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -158,6 +158,8 @@ The same builder core, the same four verbs. Import from
|
|
|
158
158
|
`uip maestro case compile` / `uip maestro bpmn compile`. Their builder surfaces are in the same
|
|
159
159
|
generated indexes as Flow's — `api-index.md` by symbol name, `api-members.md` by
|
|
160
160
|
field or method name — which cover all three entry points.
|
|
161
|
+
BPMN also gets `dist/bpmn-api.md`: every builder method and option field, one line each, with its type and one-line doc.
|
|
162
|
+
`uip maestro bpmn check --source` type-checks the `.bpmn.ts` before running it, so a misspelled option or a value of the wrong type is a `TS<code>` error at `file:line:col` rather than a crash; `--no-types` skips that pass.
|
|
161
163
|
|
|
162
164
|
The package is ESM.
|
|
163
165
|
Every entry also answers CommonJS resolution, so `require.resolve` of a subpath such as `@uipath/maestro-builder-sdk/bpmn` finds the file on disk, and on Node 22.12 or later `require()` loads it too.
|
package/dist/api-index.md
CHANGED
|
@@ -14,6 +14,10 @@ reference pages are "one line per field". Those are not here — they are in
|
|
|
14
14
|
[`api-members.md`](api-members.md), keyed by the member's own name. This file
|
|
15
15
|
indexes the exports: interfaces, types, functions, classes, consts.
|
|
16
16
|
|
|
17
|
+
**Authoring BPMN? Start in [`bpmn-api.md`](bpmn-api.md), not here.** It lists every
|
|
18
|
+
builder method and option field of `@uipath/maestro-builder-sdk/bpmn` with its type and
|
|
19
|
+
one-line doc, so the row you land on is the answer and no `.d.ts` read follows.
|
|
20
|
+
|
|
17
21
|
**Read the declaration, not a description of it.** The `.d.ts` is what the
|
|
18
22
|
compiler checks your source against, and it carries the `@remarks` and
|
|
19
23
|
`@example` bodies the reference pages leave out. The span below is the whole
|
|
@@ -37,7 +41,7 @@ could hand you spans for a version you do not have.
|
|
|
37
41
|
|
|
38
42
|
## `@uipath/maestro-builder-sdk`
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
254 symbol(s). Import from `@uipath/maestro-builder-sdk`.
|
|
41
45
|
|
|
42
46
|
| Symbol | Kind | Declaration | Area | Summary |
|
|
43
47
|
| --- | --- | --- | --- | --- |
|
|
@@ -77,6 +81,8 @@ could hand you spans for a version you do not have.
|
|
|
77
81
|
| `CanonicalFormFieldType` | type | `dist/core/actions.d.ts:59-65` | Supporting types | The platform's 11 canonical quick-form field types (`@uipath/hitl-schema-types` `fieldType`), which the designer saves. |
|
|
78
82
|
| `CaseValue` | type | `dist/flow-sdk.d.ts:182-183` | Supporting types | A value a `.switch` case compares the discriminant against. |
|
|
79
83
|
| `ChildFlow` | type | `dist/flow-sdk.d.ts:62-65` | Supporting types | Anything `subflow()` accepts as the child: a builder, or an already-built flow. |
|
|
84
|
+
| `ClassificationClass` | interface | `dist/nodes/document/flow/spec.d.ts:47-55` | Supporting types | One document type in a ClassificationSchema. |
|
|
85
|
+
| `ClassificationSchema` | interface | `dist/nodes/document/flow/spec.d.ts:40-46` | Supporting types | The taxonomy of a `documentClassify()` step: what the classifier chooses between. |
|
|
80
86
|
| `ClientSideToolRef` | interface | `dist/core/actions.d.ts:494-509` | Supporting types | A CLIENT-side tool: the agent asks the CALLING application to run it and hand the answer back… |
|
|
81
87
|
| `connector` | function | `dist/core/actions.d.ts:886-909` | Actions | Declare an Integration Service connector action — the typed form, where a generated descriptor supplies the nodeType and… |
|
|
82
88
|
| `connector` | function | `dist/core/actions.d.ts:910-926` | Actions | Stringly form, for a connector with no prepared module — `connector('uipath-salesforce-slack',… |
|
|
@@ -120,11 +126,11 @@ could hand you spans for a version you do not have.
|
|
|
120
126
|
| `descriptor` | function | `dist/core/connectors.d.ts:111-123` | Generated descriptors | Brand a descriptor literal with its input/output types (zero runtime cost). |
|
|
121
127
|
| `dim` | function | `dist/flow-sdk.d.ts:610-632` | Flow construction | A node's size on the canvas, in pixels — the third argument of at. |
|
|
122
128
|
| `documentClassify` | function | `dist/nodes/document/flow/factories.d.ts:8-19` | Actions | Classify a document into a document type (`uipath.document.classify`). |
|
|
123
|
-
| `DocumentClassifyInputs` | interface | `dist/nodes/document/flow/spec.d.ts:10-
|
|
129
|
+
| `DocumentClassifyInputs` | interface | `dist/nodes/document/flow/spec.d.ts:10-39` | Option shapes | What `documentClassify()` takes: the document, and how to split and classify it. |
|
|
124
130
|
| `DocValidationInputs` | interface | `dist/nodes/hitl/flow/spec.d.ts:76-99` | Option shapes | The Document Validation task's subject — `variant: 'document-validation'` only. |
|
|
125
131
|
| `DoWhileOptions` | interface | `dist/flow-sdk.d.ts:435-444` | Option shapes | Do-while options. |
|
|
126
132
|
| `dynamicExtract` | function | `dist/nodes/document/flow/factories.d.ts:20-30` | Actions | Extract fields from a document with an INLINE schema — Dynamic Extract (`uipath.ixp.extract-document-builder`), the… |
|
|
127
|
-
| `DynamicExtractInputs` | interface | `dist/nodes/document/flow/spec.d.ts:
|
|
133
|
+
| `DynamicExtractInputs` | interface | `dist/nodes/document/flow/spec.d.ts:56-91` | Option shapes | What `dynamicExtract()` takes: the document and the fields to extract from it. |
|
|
128
134
|
| `EdgeRoute` | interface | `dist/flow-sdk.d.ts:633-647` | Supporting types | One edge's route: user-dragged bends and/or the auto-router's waypoints. |
|
|
129
135
|
| `endCall` | function | `dist/nodes/agent/flow/factories.d.ts:26-33` | Actions | Hang up (`uipath.conversational.voice.end-call`). |
|
|
130
136
|
| `EndCallInputs` | interface | `dist/nodes/agent/flow/spec.d.ts:96-104` | Option shapes | What `endCall()` takes: the call to hang up. |
|
|
@@ -185,7 +191,7 @@ could hand you spans for a version you do not have.
|
|
|
185
191
|
| `input` | function | `dist/core/expr.d.ts:44-61` | Expressions and types | Reference a flow input by name → `$vars.<triggerId>.output.<name>`. |
|
|
186
192
|
| `isLookupToken` | function | `dist/core/lookups.d.ts:53-54` | Generated descriptors | True when `v` is an unresolved LookupToken. |
|
|
187
193
|
| `ixpExtract` | function | `dist/nodes/document/flow/factories.d.ts:31-85` | Actions | Extract fields from a document with a published IxP project — the platform's **Extract** node (`uipath.ixp.*`, service… |
|
|
188
|
-
| `IxpExtractInputs` | interface | `dist/nodes/document/flow/spec.d.ts:
|
|
194
|
+
| `IxpExtractInputs` | interface | `dist/nodes/document/flow/spec.d.ts:109-184` | Option shapes | What `ixpExtract()` takes: the IxP project's extractor, its identity on the tenant, and the document. |
|
|
189
195
|
| `IxpToolRef` | interface | `dist/core/actions.d.ts:668-706` | Supporting types | A published IxP (Intelligent eXtraction Platform) project as a tool — the agent decides when to extract a document and… |
|
|
190
196
|
| `js` | function | `dist/core/expr.d.ts:247-282` | Expressions and types | Build a raw JS *expression* (a condition or computation). |
|
|
191
197
|
| `lit` | function | `dist/core/expr.d.ts:22-28` | Expressions and types | A constant value baked directly into a node input. |
|
|
@@ -404,7 +410,7 @@ could hand you spans for a version you do not have.
|
|
|
404
410
|
|
|
405
411
|
## `@uipath/maestro-builder-sdk/bpmn`
|
|
406
412
|
|
|
407
|
-
115 symbol(s). Import from `@uipath/maestro-builder-sdk/bpmn`.
|
|
413
|
+
115 symbol(s). Import from `@uipath/maestro-builder-sdk/bpmn`. Every method and option field below, with its type and doc, is in [`bpmn-api.md`](bpmn-api.md) — read that first.
|
|
408
414
|
|
|
409
415
|
| Symbol | Kind | Declaration | Area | Summary |
|
|
410
416
|
| --- | --- | --- | --- | --- |
|
package/dist/api-members.md
CHANGED
|
@@ -5,19 +5,23 @@
|
|
|
5
5
|
|
|
6
6
|
# Maestro Builder SDK — member index
|
|
7
7
|
|
|
8
|
-
**A lookup table of
|
|
8
|
+
**A lookup table of 1309 rows — match one name in it, do not read it.**
|
|
9
9
|
Grep or search for the member you have; the row it lands on is the whole
|
|
10
10
|
answer. Reading top to bottom costs ~20x what the one row does and tells you
|
|
11
11
|
nothing you asked for.
|
|
12
12
|
|
|
13
|
-
Every field and method of every exported shape —
|
|
14
|
-
|
|
13
|
+
Every field and method of every exported shape — 1309 across
|
|
14
|
+
244 interfaces and classes — keyed by the MEMBER's own name.
|
|
15
15
|
|
|
16
16
|
**Use this when the name you have is a field or a method**, which is usually
|
|
17
17
|
the case: the reference pages are "one line per field", so you arrive holding
|
|
18
18
|
`outcomePorts`, not `HitlInputs`. Look it up here and you get the shape that
|
|
19
19
|
declares it and the exact lines that declare it.
|
|
20
20
|
|
|
21
|
+
**Authoring BPMN? Search [`bpmn-api.md`](bpmn-api.md) instead.** It has the same members
|
|
22
|
+
of `@uipath/maestro-builder-sdk/bpmn` WITH their type and one-line doc, so the row is the
|
|
23
|
+
answer and there is no span to follow.
|
|
24
|
+
|
|
21
25
|
[`api-index.md`](api-index.md) is the other half: the same thing keyed by the
|
|
22
26
|
exported symbol (interfaces, types, functions, classes, consts).
|
|
23
27
|
|
|
@@ -28,7 +32,7 @@ truncated summary would, for less. Read the span.
|
|
|
28
32
|
Member names repeat across shapes (`name` is declared on 69 of them), so the
|
|
29
33
|
`Declared on` column is what makes a match actionable. For the whole shape
|
|
30
34
|
rather than the one field, look that name up in [`api-index.md`](api-index.md) —
|
|
31
|
-
which is why its span is not repeated on all
|
|
35
|
+
which is why its span is not repeated on all 1309 rows here.
|
|
32
36
|
|
|
33
37
|
**A name that misses both indexes is probably not part of the API.** The one
|
|
34
38
|
that comes up is a RUNTIME output key — a human task's `Action`, a step's
|
|
@@ -140,6 +144,8 @@ not find it either.
|
|
|
140
144
|
| `child` | property | `SubflowSpec` | `dist/flow-sdk.d.ts:55-56` |
|
|
141
145
|
| `choose` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:3137-3178` |
|
|
142
146
|
| `citationMode` | property | `BuiltinToolRef` | `dist/core/actions.d.ts:583-584` |
|
|
147
|
+
| `classes` | property | `ClassificationSchema` | `dist/nodes/document/flow/spec.d.ts:44-45` |
|
|
148
|
+
| `classificationSchema` | property | `DocumentClassifyInputs` | `dist/nodes/document/flow/spec.d.ts:20-38` |
|
|
143
149
|
| `code` | property | `ContributionDiagnostic` | `dist/core/node-classes.d.ts:27-28` |
|
|
144
150
|
| `code` | property | `ErrorDecl` | `dist/bpmn/bpmn-sdk.d.ts:469-470` |
|
|
145
151
|
| `code` | property | `ErrorMappingRow` | `dist/bpmn/bpmn-sdk.d.ts:329-337` |
|
|
@@ -263,7 +269,7 @@ not find it either.
|
|
|
263
269
|
| `description` | method | `FlowBuilder` | `dist/flow-sdk.d.ts:1305-1312` |
|
|
264
270
|
| `description` | property | `FormFieldSettings` | `dist/core/actions.d.ts:204-205` |
|
|
265
271
|
| `description` | property | `HttpRequestToolRef` | `dist/core/actions.d.ts:520` |
|
|
266
|
-
| `description` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
272
|
+
| `description` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:176-183` |
|
|
267
273
|
| `description` | property | `IxpToolRef` | `dist/core/actions.d.ts:693-694` |
|
|
268
274
|
| `description` | property | `ManualTriggerOpts` | `dist/case/case-sdk.d.ts:297` |
|
|
269
275
|
| `description` | property | `McpToolRef` | `dist/core/actions.d.ts:456` |
|
|
@@ -304,7 +310,7 @@ not find it either.
|
|
|
304
310
|
| `displayName` | property | `SlaOpts` | `dist/case/case-sdk.d.ts:255-260` |
|
|
305
311
|
| `displayName` | property | `TriggerMeta` | `dist/core/connectors.d.ts:140-141` |
|
|
306
312
|
| `document` | property | `HitlInputs` | `dist/nodes/hitl/flow/spec.d.ts:419-423` |
|
|
307
|
-
| `documentClassify` | property | `FlowActionSpecs` | `dist/nodes/document/flow/spec.d.ts:
|
|
313
|
+
| `documentClassify` | property | `FlowActionSpecs` | `dist/nodes/document/flow/spec.d.ts:187-190` |
|
|
308
314
|
| `documentExtraction` | property | `BuiltTask` | `dist/case/case-sdk.d.ts:950-951` |
|
|
309
315
|
| `documentExtraction` | method | `TaskBuilder` | `dist/case/case-sdk.d.ts:1464-1482` |
|
|
310
316
|
| `documentExtractionSaved` | property | `BuiltTask` | `dist/case/case-sdk.d.ts:952-953` |
|
|
@@ -314,7 +320,7 @@ not find it either.
|
|
|
314
320
|
| `draft` | property | `StepOptions` | `dist/flow-sdk.d.ts:302-316` |
|
|
315
321
|
| `dueDate` | property | `QueueItemInputs` | `dist/nodes/queue/flow/spec.d.ts:50-51` |
|
|
316
322
|
| `duration` | property | `TimerSpec` | `dist/bpmn/bpmn-sdk.d.ts:35-36` |
|
|
317
|
-
| `dynamicExtract` | property | `FlowActionSpecs` | `dist/nodes/document/flow/spec.d.ts:
|
|
323
|
+
| `dynamicExtract` | property | `FlowActionSpecs` | `dist/nodes/document/flow/spec.d.ts:191-194` |
|
|
318
324
|
| `dynamicFewShotLearning` | property | `AgentMemoryRef` | `dist/core/actions.d.ts:556-557` |
|
|
319
325
|
| `edges` | property | `FlowLayout` | `dist/flow-sdk.d.ts:706-707` |
|
|
320
326
|
| `effects` | property | `FormFieldRule` | `dist/core/actions.d.ts:161-162` |
|
|
@@ -416,8 +422,8 @@ not find it either.
|
|
|
416
422
|
| `fileExtension` | property | `BuiltinToolRef` | `dist/core/actions.d.ts:581-582` |
|
|
417
423
|
| `fileExtension` | property | `ContextIndexRef` | `dist/core/actions.d.ts:807-808` |
|
|
418
424
|
| `fileRef` | property | `DocumentClassifyInputs` | `dist/nodes/document/flow/spec.d.ts:12-13` |
|
|
419
|
-
| `fileRef` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
420
|
-
| `fileRef` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
425
|
+
| `fileRef` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:58-59` |
|
|
426
|
+
| `fileRef` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:150-164` |
|
|
421
427
|
| `filter` | property | `ConnectorEventOpts` | `dist/bpmn/bpmn-sdk.d.ts:1559-1574` |
|
|
422
428
|
| `filters` | property | `ConnectorEventOpts` | `dist/bpmn/bpmn-sdk.d.ts:1575-1590` |
|
|
423
429
|
| `filters` | property | `DataFabricReadInputs` | `dist/nodes/data-fabric/flow/spec.d.ts:85-86` |
|
|
@@ -458,7 +464,7 @@ not find it either.
|
|
|
458
464
|
| `folderKey` | property | `OrchestratorOpts` | `dist/bpmn/bpmn-sdk.d.ts:1325-1333` |
|
|
459
465
|
| `folderKey` | property | `RemoteA2aToolRef` | `dist/core/actions.d.ts:491` |
|
|
460
466
|
| `FolderKey` | property | `FlowMetadata` | `dist/nodes/script/flow/spec.d.ts:85-86` |
|
|
461
|
-
| `folderName` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
467
|
+
| `folderName` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:143-149` |
|
|
462
468
|
| `folderPath` | property | `AgenticProcessInputsBase` | `dist/nodes/process/flow/spec.d.ts:214-221` |
|
|
463
469
|
| `folderPath` | property | `AgentInputs` | `dist/nodes/process/flow/spec.d.ts:317-328` |
|
|
464
470
|
| `folderPath` | property | `ApiWorkflowInputs` | `dist/nodes/process/flow/spec.d.ts:92-99` |
|
|
@@ -466,7 +472,7 @@ not find it either.
|
|
|
466
472
|
| `folderPath` | property | `ConnectorEventOpts` | `dist/bpmn/bpmn-sdk.d.ts:1540-1546` |
|
|
467
473
|
| `folderPath` | property | `ContextIndexRef` | `dist/core/actions.d.ts:791-792` |
|
|
468
474
|
| `folderPath` | property | `HitlConnection` | `dist/nodes/hitl/flow/spec.d.ts:30-31` |
|
|
469
|
-
| `folderPath` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
475
|
+
| `folderPath` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:169-175` |
|
|
470
476
|
| `folderPath` | property | `McpToolRef` | `dist/core/actions.d.ts:457-458` |
|
|
471
477
|
| `folderPath` | property | `ProcessToolRef` | `dist/core/actions.d.ts:655-656` |
|
|
472
478
|
| `folderPath` | property | `PublishedFunctionInputs` | `dist/nodes/process/flow/spec.d.ts:156-166` |
|
|
@@ -483,6 +489,7 @@ not find it either.
|
|
|
483
489
|
| `from` | property | `CreateOutgoingCallInputs` | `dist/nodes/agent/flow/spec.d.ts:88-92` |
|
|
484
490
|
| `fromFunction` | property | `CaseScriptSpec` | `dist/case/case-sdk.d.ts:563-564` |
|
|
485
491
|
| `function` | method | `TaskBuilder` | `dist/case/case-sdk.d.ts:1321-1336` |
|
|
492
|
+
| `generalInstructions` | property | `ClassificationSchema` | `dist/nodes/document/flow/spec.d.ts:42-43` |
|
|
486
493
|
| `goto` | method | `PathBuilder` | `dist/bpmn/bpmn-sdk.d.ts:3447-3471` |
|
|
487
494
|
| `guardrails` | property | `ConversationalAgentInputs` | `dist/nodes/agent/flow/spec.d.ts:77-78` |
|
|
488
495
|
| `guardrails` | property | `InlineAgentInputs` | `dist/nodes/agent/flow/spec.d.ts:304-320` |
|
|
@@ -514,6 +521,7 @@ not find it either.
|
|
|
514
521
|
| `id` | property | `BuiltFlow` | `dist/flow-sdk.d.ts:723` |
|
|
515
522
|
| `id` | property | `BuiltInValidatorGuardrail` | `dist/core/actions.d.ts:355-356` |
|
|
516
523
|
| `id` | property | `CaseAppSection` | `dist/case/case-sdk.d.ts:1052-1053` |
|
|
524
|
+
| `id` | property | `ClassificationClass` | `dist/nodes/document/flow/spec.d.ts:49-50` |
|
|
517
525
|
| `id` | property | `ContextIndexRef` | `dist/core/actions.d.ts:785-790` |
|
|
518
526
|
| `id` | property | `CustomGuardrail` | `dist/core/actions.d.ts:342-343` |
|
|
519
527
|
| `id` | property | `ErrorDecl` | `dist/bpmn/bpmn-sdk.d.ts:465-466` |
|
|
@@ -581,6 +589,7 @@ not find it either.
|
|
|
581
589
|
| `inputSchema` | property | `ScriptTaskOpts` | `dist/bpmn/bpmn-sdk.d.ts:975-986` |
|
|
582
590
|
| `inputTarget` | property | `RegistryTypeSpec` | `dist/bpmn/typed-node.d.ts:93` |
|
|
583
591
|
| `InstanceId` | property | `FlowMetadata` | `dist/nodes/script/flow/spec.d.ts:87-88` |
|
|
592
|
+
| `instructions` | property | `ClassificationClass` | `dist/nodes/document/flow/spec.d.ts:53-54` |
|
|
584
593
|
| `intermediateCatchEvent` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:2361-2368` |
|
|
585
594
|
| `intermediateThrowEvent` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:2369-2376` |
|
|
586
595
|
| `internal` | property | `BpmnVarDecl` | `dist/bpmn/bpmn-sdk.d.ts:422-423` |
|
|
@@ -599,7 +608,7 @@ not find it either.
|
|
|
599
608
|
| `item` | property | `QueueItemOpts` | `dist/bpmn/bpmn-sdk.d.ts:1374-1375` |
|
|
600
609
|
| `items` | property | `ActionSchemaProperty` | `dist/nodes/hitl/flow/spec.d.ts:269-270` |
|
|
601
610
|
| `itemVar` | property | `LoopSpec` | `dist/bpmn/bpmn-sdk.d.ts:83-84` |
|
|
602
|
-
| `ixpExtract` | property | `FlowActionSpecs` | `dist/nodes/document/flow/spec.d.ts:
|
|
611
|
+
| `ixpExtract` | property | `FlowActionSpecs` | `dist/nodes/document/flow/spec.d.ts:195-198` |
|
|
603
612
|
| `join` | property | `ChooseOpts` | `dist/bpmn/bpmn-sdk.d.ts:1953-1954` |
|
|
604
613
|
| `join` | property | `SplitOpts` | `dist/bpmn/bpmn-sdk.d.ts:1960-1961` |
|
|
605
614
|
| `js` | property | `Expr` | `dist/core/expr.d.ts:17` |
|
|
@@ -712,15 +721,15 @@ not find it either.
|
|
|
712
721
|
| `mode` | property | `InlineAgentInputs` | `dist/nodes/agent/flow/spec.d.ts:297-303` |
|
|
713
722
|
| `model` | property | `CaseDocumentExtractionSpec` | `dist/case/case-sdk.d.ts:637-638` |
|
|
714
723
|
| `model` | property | `ConversationalAgentInputs` | `dist/nodes/agent/flow/spec.d.ts:46-47` |
|
|
715
|
-
| `model` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
724
|
+
| `model` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:60-79` |
|
|
716
725
|
| `model` | property | `InlineAgentInputs` | `dist/nodes/agent/flow/spec.d.ts:165-172` |
|
|
717
726
|
| `model` | property | `VoiceSettings` | `dist/nodes/agent/flow/spec.d.ts:117-118` |
|
|
718
727
|
| `modelConfig` | property | `DocumentClassifyInputs` | `dist/nodes/document/flow/spec.d.ts:18-19` |
|
|
719
|
-
| `modelConfig` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
728
|
+
| `modelConfig` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:89-90` |
|
|
720
729
|
| `modelMaxTokens` | property | `ConversationalAgentInputs` | `dist/nodes/agent/flow/spec.d.ts:68-74` |
|
|
721
730
|
| `modelMaxTokens` | property | `InlineAgentInputs` | `dist/nodes/agent/flow/spec.d.ts:287-294` |
|
|
722
731
|
| `modelMaxTokens` | property | `VoiceSettings` | `dist/nodes/agent/flow/spec.d.ts:125-126` |
|
|
723
|
-
| `modelName` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
732
|
+
| `modelName` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:125-136` |
|
|
724
733
|
| `mustClose` | property | `ScopeStorage` | `dist/bpmn/bpmn-sdk.d.ts:2071-2075` |
|
|
725
734
|
| `name` | property | `ActionAppRef` | `dist/case/case-sdk.d.ts:834-835` |
|
|
726
735
|
| `name` | property | `ActionField` | `dist/case/case-sdk.d.ts:795-796` |
|
|
@@ -749,6 +758,7 @@ not find it either.
|
|
|
749
758
|
| `name` | property | `CaseVarDecl` | `dist/case/case-sdk.d.ts:1020` |
|
|
750
759
|
| `name` | property | `CatchOpts` | `dist/bpmn/bpmn-sdk.d.ts:761-762` |
|
|
751
760
|
| `name` | property | `ChooseOpts` | `dist/bpmn/bpmn-sdk.d.ts:1946-1947` |
|
|
761
|
+
| `name` | property | `ClassificationClass` | `dist/nodes/document/flow/spec.d.ts:51-52` |
|
|
752
762
|
| `name` | property | `ClientSideToolRef` | `dist/core/actions.d.ts:501-502` |
|
|
753
763
|
| `name` | property | `ConnectorEventOpts` | `dist/bpmn/bpmn-sdk.d.ts:1534-1535` |
|
|
754
764
|
| `name` | property | `ConnectorOutputRow` | `dist/bpmn/bpmn-sdk.d.ts:3351-3352` |
|
|
@@ -773,7 +783,7 @@ not find it either.
|
|
|
773
783
|
| `name` | property | `HttpOpts` | `dist/bpmn/bpmn-sdk.d.ts:1198-1199` |
|
|
774
784
|
| `name` | property | `HttpRequestToolRef` | `dist/core/actions.d.ts:518-519` |
|
|
775
785
|
| `name` | property | `HumanTaskCommonOpts` | `dist/bpmn/bpmn-sdk.d.ts:1400-1401` |
|
|
776
|
-
| `name` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
786
|
+
| `name` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:137-142` |
|
|
777
787
|
| `name` | property | `IxpToolRef` | `dist/core/actions.d.ts:691-692` |
|
|
778
788
|
| `name` | property | `JoinOpts` | `dist/bpmn/bpmn-sdk.d.ts:1941-1942` |
|
|
779
789
|
| `name` | property | `ManualTriggerOpts` | `dist/case/case-sdk.d.ts:296` |
|
|
@@ -894,8 +904,8 @@ not find it either.
|
|
|
894
904
|
| `outputVar` | property | `ReceiveMessageOpts` | `dist/bpmn/bpmn-sdk.d.ts:1503-1504` |
|
|
895
905
|
| `pageRange` | property | `CaseDocumentExtractionSpec` | `dist/case/case-sdk.d.ts:663-664` |
|
|
896
906
|
| `pageRange` | property | `DocumentClassifyInputs` | `dist/nodes/document/flow/spec.d.ts:14-15` |
|
|
897
|
-
| `pageRange` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
898
|
-
| `pageRange` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
907
|
+
| `pageRange` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:87-88` |
|
|
908
|
+
| `pageRange` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:165-166` |
|
|
899
909
|
| `parallel` | property | `LoopOptions` | `dist/flow-sdk.d.ts:422-423` |
|
|
900
910
|
| `parallel` | method | `StepList` | `dist/flow-sdk.d.ts:1034-1076` |
|
|
901
911
|
| `parallelGateway` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:2394-2403` |
|
|
@@ -932,7 +942,7 @@ not find it either.
|
|
|
932
942
|
| `process` | method | `TaskBuilder` | `dist/case/case-sdk.d.ts:1231-1240` |
|
|
933
943
|
| `processId` | property | `SugarRegistry` | `dist/bpmn/bpmn-sdk.d.ts:2095-2100` |
|
|
934
944
|
| `ProcessKey` | property | `FlowMetadata` | `dist/nodes/script/flow/spec.d.ts:89-90` |
|
|
935
|
-
| `project` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
945
|
+
| `project` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:111-124` |
|
|
936
946
|
| `projectId` | property | `AgenticProcessInputsBase` | `dist/nodes/process/flow/spec.d.ts:222-229` |
|
|
937
947
|
| `projectId` | property | `AgentInputs` | `dist/nodes/process/flow/spec.d.ts:329-334` |
|
|
938
948
|
| `projectId` | property | `ApiWorkflowInputs` | `dist/nodes/process/flow/spec.d.ts:100-108` |
|
|
@@ -1052,7 +1062,7 @@ not find it either.
|
|
|
1052
1062
|
| `schema` | method | `BpmnBuilder` | `dist/bpmn/bpmn-sdk.d.ts:3666-3691` |
|
|
1053
1063
|
| `schema` | property | `BpmnVarDecl` | `dist/bpmn/bpmn-sdk.d.ts:416-417` |
|
|
1054
1064
|
| `schema` | property | `DataServiceOpts` | `dist/bpmn/bpmn-sdk.d.ts:1180-1185` |
|
|
1055
|
-
| `schema` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
1065
|
+
| `schema` | property | `DynamicExtractInputs` | `dist/nodes/document/flow/spec.d.ts:80-86` |
|
|
1056
1066
|
| `schema` | property | `TypedOutputRow` | `dist/bpmn/typed-node.d.ts:300-301` |
|
|
1057
1067
|
| `schema` | property | `VarDecl` | `dist/flow-sdk.d.ts:74-75` |
|
|
1058
1068
|
| `schema` | property | `VarOpts` | `dist/bpmn/bpmn-sdk.d.ts:1800-1813` |
|
|
@@ -1319,7 +1329,7 @@ not find it either.
|
|
|
1319
1329
|
| `version` | property | `NodeOptions` | `dist/flow-sdk.d.ts:240-247` |
|
|
1320
1330
|
| `version` | property | `TriggerMeta` | `dist/core/connectors.d.ts:139` |
|
|
1321
1331
|
| `version` | property | `TriggerOptions` | `dist/core/actions.d.ts:1049-1050` |
|
|
1322
|
-
| `versionTag` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:
|
|
1332
|
+
| `versionTag` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:167-168` |
|
|
1323
1333
|
| `versionTag` | property | `IxpToolRef` | `dist/core/actions.d.ts:695-696` |
|
|
1324
1334
|
| `voice` | property | `VoiceAgentInputs` | `dist/nodes/agent/flow/spec.d.ts:148-149` |
|
|
1325
1335
|
| `voiceAgent` | property | `FlowActionSpecs` | `dist/nodes/agent/flow/spec.d.ts:435-438` |
|
package/dist/bpmn/check-cli.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* check-cli — fast static validation of a <Name>.bpmn.ts (no output file).
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* node --experimental-strip-types check-cli.js <bpmn.ts | BaseName> [--graph] \
|
|
6
|
+
* node --experimental-strip-types check-cli.js <bpmn.ts | BaseName> [--graph] [--no-types] \
|
|
7
7
|
* [--library <library-json dir>] [--connectors-local <overlay dir>] [--bindings <bindings.json>] \
|
|
8
8
|
* [--resources <resources.json>]
|
|
9
9
|
*
|
|
@@ -13,11 +13,17 @@
|
|
|
13
13
|
* Exit 0 = clean; exit 1 = at least one error. Warnings print but do not fail.
|
|
14
14
|
* `--graph` also prints the resolved wiring to stdout — every element with the flows
|
|
15
15
|
* leaving it, implied edges marked — see graph.ts.
|
|
16
|
+
*
|
|
17
|
+
* The source is type-checked first (source-types.ts): a wrong option name or a
|
|
18
|
+
* value of the wrong type is a `TS<code>` error with its `file:line:col`, and it
|
|
19
|
+
* is reported even when the source then crashes on load or in the check.
|
|
20
|
+
* `--no-types` skips it.
|
|
16
21
|
*/
|
|
17
22
|
import { existsSync } from 'node:fs';
|
|
18
23
|
import { printResult, reportDiagnostics, reportResult } from '../cli-result.js';
|
|
19
24
|
import { resolveBpmnFile, loadBuiltBpmn } from './load.js';
|
|
20
25
|
import { check } from './check.js';
|
|
26
|
+
import { sourceTypeDiagnostics } from './source-types.js';
|
|
21
27
|
import { graphModel, renderGraph } from './graph.js';
|
|
22
28
|
import { Bindings } from '../core/bindings.js';
|
|
23
29
|
import { connectorCheckOpts, openCliLibrary } from '../core/cli-library.js';
|
|
@@ -39,20 +45,46 @@ function bpmnCheckOpts(argv) {
|
|
|
39
45
|
const resources = readCliResources(argv, defaultResourcesFile());
|
|
40
46
|
return { ...connectorCheckOpts(openCliLibrary(argv), bindFile ? new Bindings(bindFile) : undefined), ...(resources ? { resources } : {}) };
|
|
41
47
|
}
|
|
48
|
+
function printDiagnostics(diags) {
|
|
49
|
+
for (const d of diags)
|
|
50
|
+
console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
|
|
51
|
+
}
|
|
52
|
+
/** The diagnostics, both as the `--json` result and as the printed lines. */
|
|
53
|
+
function report(diags) {
|
|
54
|
+
reportDiagnostics(diags);
|
|
55
|
+
printDiagnostics(diags);
|
|
56
|
+
}
|
|
42
57
|
export async function run(argv) {
|
|
43
58
|
if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
|
|
44
|
-
console.error('usage: check <bpmn.ts | BaseName> [--graph] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
|
|
59
|
+
console.error('usage: check <bpmn.ts | BaseName> [--graph] [--no-types] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
|
|
45
60
|
return 2;
|
|
46
61
|
}
|
|
47
62
|
ensureTypeScriptRuntime();
|
|
48
63
|
const graph = argv.includes('--graph');
|
|
49
64
|
const input = argv.find((a, i) => !a.startsWith('--') && !VALUE_FLAGS.has(argv[i - 1]));
|
|
50
65
|
if (input === undefined) {
|
|
51
|
-
console.error('usage: check <bpmn.ts | BaseName> [--graph] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
|
|
66
|
+
console.error('usage: check <bpmn.ts | BaseName> [--graph] [--no-types] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
|
|
52
67
|
return 2;
|
|
53
68
|
}
|
|
54
|
-
const
|
|
55
|
-
const
|
|
69
|
+
const file = resolveBpmnFile(input);
|
|
70
|
+
const typeDiags = argv.includes('--no-types') ? [] : sourceTypeDiagnostics(file);
|
|
71
|
+
let built;
|
|
72
|
+
let diags;
|
|
73
|
+
try {
|
|
74
|
+
built = await loadBuiltBpmn(file);
|
|
75
|
+
diags = [...typeDiags, ...check(built, bpmnCheckOpts(argv))];
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
// A value of the wrong type usually crashes the build or the check before
|
|
79
|
+
// either reports anything (`expr.startsWith is not a function`). The type
|
|
80
|
+
// errors are the explanation, so they go out first, then the crash.
|
|
81
|
+
if (!typeDiags.some((d) => d.level === 'error'))
|
|
82
|
+
throw error;
|
|
83
|
+
report(typeDiags);
|
|
84
|
+
console.error(`check: the source also failed to run: ${error instanceof Error ? error.message : String(error)}`);
|
|
85
|
+
console.error(`check: ${typeDiags.filter((d) => d.level === 'error').length} type error(s); fix them first.`);
|
|
86
|
+
return 1;
|
|
87
|
+
}
|
|
56
88
|
reportDiagnostics(diags);
|
|
57
89
|
if (graph) {
|
|
58
90
|
// The graph goes to stdout and the diagnostics to stderr, so a reviewer can
|
|
@@ -61,8 +93,7 @@ export async function run(argv) {
|
|
|
61
93
|
printResult(renderGraph(built).trimEnd());
|
|
62
94
|
reportResult({ graph: graphModel(built) });
|
|
63
95
|
}
|
|
64
|
-
|
|
65
|
-
console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
|
|
96
|
+
printDiagnostics(diags);
|
|
66
97
|
const errors = diags.filter((d) => d.level === 'error').length;
|
|
67
98
|
if (errors) {
|
|
68
99
|
console.error(`check: ${errors} error(s).`);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Diagnostic } from './check.js';
|
|
2
|
+
/**
|
|
3
|
+
* The libraries the program reads: what Node >= 22.6 implements. ES2024
|
|
4
|
+
* (`toSorted`, `Object.groupBy`) plus the later pieces Node 22 already ships:
|
|
5
|
+
* the Set methods (`union`), the iterator helpers (`Iterator.from`) and
|
|
6
|
+
* `Array.fromAsync`. No DOM: `lib.dom.d.ts` is two thirds of the text a DOM
|
|
7
|
+
* program reads and tripled its cold build. Node's own globals come from
|
|
8
|
+
* RUNTIME_GLOBALS instead.
|
|
9
|
+
*
|
|
10
|
+
* The `esnext.*` files are not a fixed set: a later TypeScript can add an API
|
|
11
|
+
* to one that Node 22 lacks, and `check` would then pass a call that throws.
|
|
12
|
+
* `bpmn-cli.test.ts` pins every declaration they make, so such an addition
|
|
13
|
+
* fails a test instead of reaching an author.
|
|
14
|
+
*/
|
|
15
|
+
export declare const TYPE_CHECK_LIBS: readonly ["lib.es2024.d.ts", "lib.esnext.collection.d.ts", "lib.esnext.iterator.d.ts", "lib.esnext.array.d.ts"];
|
|
16
|
+
/** Every type error in `file` and the author's files it imports, or none. */
|
|
17
|
+
export declare function sourceTypeDiagnostics(file: string): Diagnostic[];
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { dirname, isAbsolute, join, relative } from 'node:path';
|
|
2
|
+
import { typescript } from '../core/typescript-module.js';
|
|
3
|
+
import { sdkResolvingHost } from '../script-function-scope.js';
|
|
4
|
+
/**
|
|
5
|
+
* TypeScript codes that mean "the program could not see something", not "the
|
|
6
|
+
* call is wrong": cannot find module (2307, 2792), the "install type
|
|
7
|
+
* definitions for node" family (2580, 2591, 2592, 2593) for a name the shim
|
|
8
|
+
* leaves out, a DOM-only global (2584), a missing type library (2688). A plain
|
|
9
|
+
* missing name (2304) stays an error: it is usually a typo, or a CommonJS name
|
|
10
|
+
* (`__dirname`) that an ES module does not have when it runs either.
|
|
11
|
+
*/
|
|
12
|
+
const ENVIRONMENT_CODES = new Set([2307, 2580, 2584, 2591, 2592, 2593, 2688, 2792]);
|
|
13
|
+
/**
|
|
14
|
+
* Node's runtime globals, declared loosely, for a program that loads neither
|
|
15
|
+
* `@types/node` nor the DOM lib.
|
|
16
|
+
*
|
|
17
|
+
* The authored source runs on Node, so `setTimeout`, `fetch`, `URL`,
|
|
18
|
+
* `structuredClone`, `process` and `import.meta.url` all exist when it runs; a
|
|
19
|
+
* program without them fails `check` on a source that works. Loading
|
|
20
|
+
* `@types/node` instead would make the result depend on what the author's tree
|
|
21
|
+
* happens to have installed, and would cost more than the rest of the program,
|
|
22
|
+
* so the names are declared here as loosely as still lets them be used as
|
|
23
|
+
* values, types and constructors. Checking the author's NODE calls is not this
|
|
24
|
+
* pass's job; checking the SDK calls is. Served as a virtual `.d.ts`, so
|
|
25
|
+
* `skipLibCheck` covers it and no diagnostic is reported against it.
|
|
26
|
+
*/
|
|
27
|
+
const RUNTIME_GLOBALS = [
|
|
28
|
+
'interface ImportMeta { url: string; dirname: string; filename: string; resolve(specifier: string): string; }',
|
|
29
|
+
'declare var process: any;',
|
|
30
|
+
'declare var Buffer: any;',
|
|
31
|
+
'declare var global: typeof globalThis;',
|
|
32
|
+
'declare var console: any;',
|
|
33
|
+
'declare var crypto: any;',
|
|
34
|
+
'declare var performance: any;',
|
|
35
|
+
'declare function setTimeout(callback: (...args: any[]) => void, ms?: number, ...args: any[]): any;',
|
|
36
|
+
'declare function setInterval(callback: (...args: any[]) => void, ms?: number, ...args: any[]): any;',
|
|
37
|
+
'declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;',
|
|
38
|
+
'declare function clearTimeout(handle?: any): void;',
|
|
39
|
+
'declare function clearInterval(handle?: any): void;',
|
|
40
|
+
'declare function clearImmediate(handle?: any): void;',
|
|
41
|
+
'declare function queueMicrotask(callback: () => void): void;',
|
|
42
|
+
'declare function structuredClone<T>(value: T, options?: any): T;',
|
|
43
|
+
'declare function fetch(input: any, init?: any): Promise<any>;',
|
|
44
|
+
'declare function atob(data: string): string;',
|
|
45
|
+
'declare function btoa(data: string): string;',
|
|
46
|
+
'declare var navigator: any;',
|
|
47
|
+
'declare var WebAssembly: any;',
|
|
48
|
+
...[
|
|
49
|
+
'URL', 'URLSearchParams', 'URLPattern', 'DOMException', 'AbortController', 'AbortSignal',
|
|
50
|
+
'Event', 'EventTarget', 'CustomEvent', 'MessageEvent', 'CloseEvent', 'TextEncoder', 'TextDecoder',
|
|
51
|
+
'TransformStream', 'TransformStreamDefaultController', 'WritableStream', 'WritableStreamDefaultController',
|
|
52
|
+
'WritableStreamDefaultWriter', 'ReadableStream', 'ReadableStreamDefaultReader', 'ReadableStreamBYOBReader',
|
|
53
|
+
'ReadableStreamBYOBRequest', 'ReadableByteStreamController', 'ReadableStreamDefaultController',
|
|
54
|
+
'ByteLengthQueuingStrategy', 'CountQueuingStrategy', 'TextEncoderStream', 'TextDecoderStream',
|
|
55
|
+
'CompressionStream', 'DecompressionStream', 'BroadcastChannel', 'MessageChannel', 'MessagePort', 'Blob', 'File',
|
|
56
|
+
'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure', 'PerformanceObserver',
|
|
57
|
+
'PerformanceObserverEntryList', 'PerformanceResourceTiming', 'FormData', 'Headers', 'Request', 'Response',
|
|
58
|
+
'WebSocket', 'Crypto', 'CryptoKey', 'SubtleCrypto', 'Navigator', 'SuppressedError', 'DisposableStack',
|
|
59
|
+
'AsyncDisposableStack', 'Float16Array',
|
|
60
|
+
].map((name) => `declare class ${name} { constructor(...args: any[]); [key: string]: any; static [key: string]: any; }`),
|
|
61
|
+
].join('\n');
|
|
62
|
+
/**
|
|
63
|
+
* The libraries the program reads: what Node >= 22.6 implements. ES2024
|
|
64
|
+
* (`toSorted`, `Object.groupBy`) plus the later pieces Node 22 already ships:
|
|
65
|
+
* the Set methods (`union`), the iterator helpers (`Iterator.from`) and
|
|
66
|
+
* `Array.fromAsync`. No DOM: `lib.dom.d.ts` is two thirds of the text a DOM
|
|
67
|
+
* program reads and tripled its cold build. Node's own globals come from
|
|
68
|
+
* RUNTIME_GLOBALS instead.
|
|
69
|
+
*
|
|
70
|
+
* The `esnext.*` files are not a fixed set: a later TypeScript can add an API
|
|
71
|
+
* to one that Node 22 lacks, and `check` would then pass a call that throws.
|
|
72
|
+
* `bpmn-cli.test.ts` pins every declaration they make, so such an addition
|
|
73
|
+
* fails a test instead of reaching an author.
|
|
74
|
+
*/
|
|
75
|
+
export const TYPE_CHECK_LIBS = [
|
|
76
|
+
'lib.es2024.d.ts', 'lib.esnext.collection.d.ts', 'lib.esnext.iterator.d.ts', 'lib.esnext.array.d.ts',
|
|
77
|
+
];
|
|
78
|
+
/** The virtual file the runtime globals are served as, beside the source. */
|
|
79
|
+
const RUNTIME_GLOBALS_FILE = '__maestro-bpmn-runtime-globals__.d.ts';
|
|
80
|
+
/** Every type error in `file` and the author's files it imports, or none. */
|
|
81
|
+
export function sourceTypeDiagnostics(file) {
|
|
82
|
+
const ts = typescript();
|
|
83
|
+
const options = {
|
|
84
|
+
noEmit: true, skipLibCheck: true, allowImportingTsExtensions: true, allowJs: false,
|
|
85
|
+
// Every file is a module, as the loader runs it: Node detects a `.ts` file's
|
|
86
|
+
// ESM syntax with no `"type": "module"` (so top-level `await` works), where
|
|
87
|
+
// NodeNext would type it as CommonJS and refuse the `await` (TS1309).
|
|
88
|
+
// Bundler resolution still honours the SDK's `exports` and their `types`.
|
|
89
|
+
target: ts.ScriptTarget.ES2023, module: ts.ModuleKind.ESNext, moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
90
|
+
moduleDetection: ts.ModuleDetectionKind.Force,
|
|
91
|
+
lib: [...TYPE_CHECK_LIBS],
|
|
92
|
+
// No automatic `@types` walk up the tree, so the result does not depend on
|
|
93
|
+
// what the author's folder happens to have installed.
|
|
94
|
+
types: [],
|
|
95
|
+
};
|
|
96
|
+
const shim = join(dirname(file), RUNTIME_GLOBALS_FILE);
|
|
97
|
+
const host = sdkResolvingHost(ts, options);
|
|
98
|
+
const getSourceFile = host.getSourceFile.bind(host);
|
|
99
|
+
host.getSourceFile = (name, language, ...rest) => (name === shim
|
|
100
|
+
? ts.createSourceFile(name, RUNTIME_GLOBALS, language)
|
|
101
|
+
: getSourceFile(name, language, ...rest));
|
|
102
|
+
const fileExists = host.fileExists.bind(host);
|
|
103
|
+
host.fileExists = (name) => name === shim || fileExists(name);
|
|
104
|
+
const program = ts.createProgram([file, shim], options, host);
|
|
105
|
+
const cwd = process.cwd();
|
|
106
|
+
const out = [];
|
|
107
|
+
for (const sf of program.getSourceFiles()) {
|
|
108
|
+
if (sf.isDeclarationFile || sf.fileName.includes('/node_modules/'))
|
|
109
|
+
continue;
|
|
110
|
+
const found = [...program.getSyntacticDiagnostics(sf), ...program.getSemanticDiagnostics(sf)];
|
|
111
|
+
for (const d of found)
|
|
112
|
+
out.push(toDiagnostic(ts, d, cwd));
|
|
113
|
+
}
|
|
114
|
+
// Program-wide ones (a bad option, a missing lib) carry no file; report them too.
|
|
115
|
+
for (const d of program.getGlobalDiagnostics())
|
|
116
|
+
out.push(toDiagnostic(ts, d, cwd));
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
function toDiagnostic(ts, d, cwd) {
|
|
120
|
+
const text = ts.flattenDiagnosticMessageText(d.messageText, '\n ');
|
|
121
|
+
let where;
|
|
122
|
+
if (d.file && d.start !== undefined) {
|
|
123
|
+
const { line, character } = d.file.getLineAndCharacterOfPosition(d.start);
|
|
124
|
+
// Relative when the file is under the working directory, as an author types it; absolute otherwise.
|
|
125
|
+
const rel = relative(cwd, d.file.fileName);
|
|
126
|
+
const shown = rel && !rel.startsWith('..') && !isAbsolute(rel) ? rel : d.file.fileName;
|
|
127
|
+
where = `${shown}:${line + 1}:${character + 1}`;
|
|
128
|
+
}
|
|
129
|
+
const environment = ENVIRONMENT_CODES.has(d.code);
|
|
130
|
+
return {
|
|
131
|
+
level: environment || d.category !== ts.DiagnosticCategory.Error ? 'warning' : 'error',
|
|
132
|
+
code: `TS${d.code}`,
|
|
133
|
+
message: where ? `${where} ${text}` : text,
|
|
134
|
+
...(where ? { where } : {}),
|
|
135
|
+
};
|
|
136
|
+
}
|