@usearazzo/runner 1.0.1-alpha.18 → 1.0.1-alpha.20
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/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/dist/arazzo-runner.browser.js +336 -179
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +14 -14
- package/src/criterion/CriterionErrorReason.cjs +51 -0
- package/src/criterion/CriterionErrorReason.mjs +46 -0
- package/src/criterion/CriterionEvaluator.cjs +63 -36
- package/src/criterion/CriterionEvaluator.mjs +63 -36
- package/src/criterion/JSONPathCriterionEvaluator.cjs +5 -4
- package/src/criterion/JSONPathCriterionEvaluator.mjs +5 -4
- package/src/criterion/RegexCriterionEvaluator.cjs +5 -4
- package/src/criterion/RegexCriterionEvaluator.mjs +5 -4
- package/src/criterion/SimpleCriterionEvaluator.cjs +5 -4
- package/src/criterion/SimpleCriterionEvaluator.mjs +5 -4
- package/src/criterion/XPathCriterionEvaluator.cjs +13 -12
- package/src/criterion/XPathCriterionEvaluator.mjs +13 -12
- package/src/errors/CriterionEvaluationError.cjs +18 -0
- package/src/errors/CriterionEvaluationError.mjs +11 -0
- package/src/index.cjs +14 -0
- package/src/index.mjs +2 -0
- package/src/vendor/swagger-client.cjs +1 -1
- package/src/vendor/swagger-client.mjs +1 -1
- package/types/runner.d.ts +85 -10
package/types/runner.d.ts
CHANGED
|
@@ -473,7 +473,64 @@ export declare type CriterionContextResolver = (expression: string) => unknown;
|
|
|
473
473
|
export declare class CriterionError extends ArazzoRunnerError {
|
|
474
474
|
readonly condition?: string;
|
|
475
475
|
readonly type?: string;
|
|
476
|
-
readonly reason?:
|
|
476
|
+
readonly reason?: CriterionErrorReason;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* The `reason` a {@link CriterionError} carries.
|
|
481
|
+
*
|
|
482
|
+
* Structural reasons mark a criterion that is malformed as written; they are
|
|
483
|
+
* thrown as a plain `CriterionError`. Evaluation reasons (`InvalidSimple`,
|
|
484
|
+
* `InvalidRegex`, `InvalidJSONPath`, `InvalidXPath`, `InvalidXPathContext`) mark
|
|
485
|
+
* a condition that cannot be evaluated; they are thrown as a
|
|
486
|
+
* {@link CriterionEvaluationError}, which `CriterionEvaluator` turns into an
|
|
487
|
+
* unmet criterion.
|
|
488
|
+
* @public
|
|
489
|
+
*/
|
|
490
|
+
export declare const CriterionErrorReason: {
|
|
491
|
+
/** The element is not a Criterion Object. */
|
|
492
|
+
readonly InvalidCriterion: "invalid-criterion";
|
|
493
|
+
/** The `condition` is missing or empty. */
|
|
494
|
+
readonly MissingCondition: "missing-condition";
|
|
495
|
+
/** The `type` is present but unreadable. */
|
|
496
|
+
readonly InvalidType: "invalid-type";
|
|
497
|
+
/** The `type` names no known criterion type. */
|
|
498
|
+
readonly UnknownType: "unknown-type";
|
|
499
|
+
/** The expression type `version` is present but not a string. */
|
|
500
|
+
readonly InvalidVersion: "invalid-version";
|
|
501
|
+
/** The expression type `version` is not the one this runner supports. */
|
|
502
|
+
readonly UnsupportedVersion: "unsupported-version";
|
|
503
|
+
/** The `context` is not a runtime expression. */
|
|
504
|
+
readonly InvalidContext: "invalid-context";
|
|
505
|
+
/** A `regex`, `jsonpath` or `xpath` criterion has no `context`. */
|
|
506
|
+
readonly MissingContext: "missing-context";
|
|
507
|
+
/** The `simple` condition cannot be parsed. */
|
|
508
|
+
readonly InvalidSimple: "invalid-simple";
|
|
509
|
+
/** The `regex` condition is not a valid regular expression. */
|
|
510
|
+
readonly InvalidRegex: "invalid-regex";
|
|
511
|
+
/** The `jsonpath` condition is not a valid JSONPath query. */
|
|
512
|
+
readonly InvalidJSONPath: "invalid-jsonpath";
|
|
513
|
+
/** The `xpath` condition is invalid or fails to evaluate. */
|
|
514
|
+
readonly InvalidXPath: "invalid-xpath";
|
|
515
|
+
/** The resolved `xpath` context is not XML. */
|
|
516
|
+
readonly InvalidXPathContext: "invalid-xpath-context";
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* One of the `CriterionErrorReason` values.
|
|
521
|
+
* @public
|
|
522
|
+
*/
|
|
523
|
+
export declare type CriterionErrorReason = (typeof CriterionErrorReason)[keyof typeof CriterionErrorReason];
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* A criterion condition that cannot be evaluated: a syntax error in the
|
|
527
|
+
* condition, a context the condition cannot apply to, or an error raised while
|
|
528
|
+
* evaluating it. The type-specific criterion evaluators throw it;
|
|
529
|
+
* `CriterionEvaluator` turns it into an unmet criterion, as Arazzo 1.1.0
|
|
530
|
+
* requires.
|
|
531
|
+
* @public
|
|
532
|
+
*/
|
|
533
|
+
export declare class CriterionEvaluationError extends CriterionError {
|
|
477
534
|
}
|
|
478
535
|
|
|
479
536
|
/**
|
|
@@ -486,12 +543,26 @@ export declare class CriterionError extends ArazzoRunnerError {
|
|
|
486
543
|
* pattern to the resolved value.
|
|
487
544
|
* - `jsonpath` — resolves the `context` runtime expression, then applies the
|
|
488
545
|
* JSONPath query to the resolved value (met when the query matches). Only the
|
|
489
|
-
* `rfc9535` version is supported
|
|
490
|
-
* throws.
|
|
546
|
+
* `rfc9535` version is supported; an explicit other version throws.
|
|
491
547
|
* - `xpath` — resolves the `context` runtime expression, then applies the XPath
|
|
492
548
|
* 3.1 query to the resolved XML value (met by the Effective Boolean Value).
|
|
493
|
-
* Only the `xpath-31` version is supported
|
|
494
|
-
*
|
|
549
|
+
* Only the `xpath-31` version is supported; an explicit other version throws.
|
|
550
|
+
*
|
|
551
|
+
* Versions follow Arazzo 1.1.0's Expression Type Object: `rfc9535` and
|
|
552
|
+
* `xpath-31` are allowed values, and an omitted `version` defaults to them.
|
|
553
|
+
* Arazzo 1.0.x lists neither and requires `version`; this evaluator applies
|
|
554
|
+
* the 1.1.0 rule to every document, which accepts more but never evaluates a
|
|
555
|
+
* query under the wrong dialect.
|
|
556
|
+
*
|
|
557
|
+
* A condition that cannot be evaluated fails the criterion (`false`), as
|
|
558
|
+
* Arazzo 1.1.0 requires: a syntax error in the condition, a context the
|
|
559
|
+
* condition cannot apply to (non-XML data for `xpath`), or an XPath evaluation
|
|
560
|
+
* error. The type-specific evaluators report these as a
|
|
561
|
+
* {@link CriterionEvaluationError}, which this facade absorbs; any other error
|
|
562
|
+
* they raise propagates. A criterion that is malformed as written still throws: a
|
|
563
|
+
* missing `condition`, an unknown or unreadable `type`, an unsupported
|
|
564
|
+
* expression `version`, or a `context` that is missing or not a runtime
|
|
565
|
+
* expression.
|
|
495
566
|
*
|
|
496
567
|
* The evaluator is agnostic about how runtime expressions are resolved: the
|
|
497
568
|
* caller supplies a {@link CriterionContextResolver} per evaluation, keeping
|
|
@@ -514,6 +585,10 @@ export declare class CriterionEvaluator {
|
|
|
514
585
|
|
|
515
586
|
/**
|
|
516
587
|
* Options for the CriterionEvaluator.
|
|
588
|
+
*
|
|
589
|
+
* An injected evaluator signals a condition it cannot evaluate by throwing a
|
|
590
|
+
* {@link CriterionEvaluationError}, which fails the criterion; any other error
|
|
591
|
+
* it throws, a plain {@link CriterionError} included, propagates.
|
|
517
592
|
* @public
|
|
518
593
|
*/
|
|
519
594
|
export declare interface CriterionEvaluatorOptions {
|
|
@@ -701,7 +776,7 @@ export declare class JSONPathCriterionEvaluator {
|
|
|
701
776
|
* whether it matched anything.
|
|
702
777
|
*
|
|
703
778
|
* Returns `false` when the context is `null` or `undefined`. Throws
|
|
704
|
-
* {@link
|
|
779
|
+
* {@link CriterionEvaluationError} when the condition is not a valid JSONPath query.
|
|
705
780
|
*/
|
|
706
781
|
evaluate(condition: string, context: unknown): boolean;
|
|
707
782
|
}
|
|
@@ -1420,7 +1495,7 @@ export declare class RegexCriterionEvaluator {
|
|
|
1420
1495
|
* Tests the resolved context value against the regular expression `condition`.
|
|
1421
1496
|
*
|
|
1422
1497
|
* The context is coerced to a string before matching. Returns `false` when the
|
|
1423
|
-
* context is `null` or `undefined`. Throws {@link
|
|
1498
|
+
* context is `null` or `undefined`. Throws {@link CriterionEvaluationError} when the
|
|
1424
1499
|
* condition is not a valid regular expression.
|
|
1425
1500
|
*/
|
|
1426
1501
|
evaluate(condition: string, context: unknown): boolean;
|
|
@@ -1780,7 +1855,7 @@ export declare function settledResult(result: WorkflowExecutionResult): Workflow
|
|
|
1780
1855
|
* compared per the library's rules (e.g. `undefined == x` and relational
|
|
1781
1856
|
* comparisons are false, matching the spec's "null equals only null"), so a
|
|
1782
1857
|
* negated or disjunctive condition may still pass. A malformed condition throws
|
|
1783
|
-
* {@link
|
|
1858
|
+
* {@link CriterionEvaluationError}.
|
|
1784
1859
|
* @public
|
|
1785
1860
|
*/
|
|
1786
1861
|
export declare class SimpleCriterionEvaluator {
|
|
@@ -2455,7 +2530,7 @@ export declare interface WorkflowReferenceContext {
|
|
|
2455
2530
|
*
|
|
2456
2531
|
* Only XPath 3.1 is supported (`fontoxpath`'s engine); version gating happens in
|
|
2457
2532
|
* the facade. Per Arazzo 1.1.0, a `null` or `undefined` context fails the
|
|
2458
|
-
* condition. An invalid query throws {@link
|
|
2533
|
+
* condition. An invalid query throws {@link CriterionEvaluationError}.
|
|
2459
2534
|
* @public
|
|
2460
2535
|
*/
|
|
2461
2536
|
export declare class XPathCriterionEvaluator {
|
|
@@ -2465,7 +2540,7 @@ export declare class XPathCriterionEvaluator {
|
|
|
2465
2540
|
* its Effective Boolean Value.
|
|
2466
2541
|
*
|
|
2467
2542
|
* Returns `false` when the context is `null` or `undefined`. Throws
|
|
2468
|
-
* {@link
|
|
2543
|
+
* {@link CriterionEvaluationError} when the context is not XML or the query is invalid.
|
|
2469
2544
|
*/
|
|
2470
2545
|
evaluate(condition: string, context: unknown): boolean;
|
|
2471
2546
|
}
|