@orkestrel/contract 0.0.20 → 0.0.21
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/src/core/index.cjs +315 -136
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +172 -5
- package/dist/src/core/index.d.ts +172 -5
- package/dist/src/core/index.js +304 -136
- package/dist/src/core/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -199,7 +199,7 @@ export declare interface ArrayShapeOptions {
|
|
|
199
199
|
* @example
|
|
200
200
|
* ```ts
|
|
201
201
|
* const outcome = attempt(() => predicate(value))
|
|
202
|
-
* return outcome
|
|
202
|
+
* return isSuccess(outcome) && outcome.value
|
|
203
203
|
* ```
|
|
204
204
|
*/
|
|
205
205
|
export declare function attempt<T>(callback: () => T): Result<T>;
|
|
@@ -476,6 +476,20 @@ export declare function buildStringFaults(shape: StringShape, value: string, pat
|
|
|
476
476
|
*/
|
|
477
477
|
export declare function canonicalStringify(value: unknown): string | undefined;
|
|
478
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Caps at `1024` the number of choices one schema field may offer, frozen.
|
|
481
|
+
*
|
|
482
|
+
* @remarks
|
|
483
|
+
* A retention limit that a declaring package, such as a form or table schema
|
|
484
|
+
* package, enforces; this package enforces none of the retention limits itself.
|
|
485
|
+
*
|
|
486
|
+
* @example
|
|
487
|
+
* ```ts
|
|
488
|
+
* CHOICE_LIMIT // 1024
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
export declare const CHOICE_LIMIT = 1024;
|
|
492
|
+
|
|
479
493
|
/**
|
|
480
494
|
* Classifies an already-bounded string against the pattern-only and
|
|
481
495
|
* calendar-checked {@link SchemaFormat} vocabulary.
|
|
@@ -646,7 +660,7 @@ export declare function cloneShape(shape: ContractShape): ContractShape;
|
|
|
646
660
|
*
|
|
647
661
|
* @remarks
|
|
648
662
|
* Extracted rather than written inline for the same reason
|
|
649
|
-
* {@link
|
|
663
|
+
* {@link comparePrimitives} is: `Reflect.apply` takes its arguments as a LIST, so an
|
|
650
664
|
* inline collector is a function expression inside an array literal rather than
|
|
651
665
|
* one passed directly as an argument — a hidden function assignment this
|
|
652
666
|
* repository forbids wherever it appears. Returned directly from a factory it is
|
|
@@ -718,10 +732,10 @@ export declare function collectMembers(values: readonly unknown[]): Set<unknown>
|
|
|
718
732
|
*
|
|
719
733
|
* @example
|
|
720
734
|
* ```ts
|
|
721
|
-
*
|
|
735
|
+
* comparePrimitives('a', 'b') // -1
|
|
722
736
|
* ```
|
|
723
737
|
*/
|
|
724
|
-
export declare function
|
|
738
|
+
export declare function comparePrimitives<T extends string | number>(left: T, right: T): number;
|
|
725
739
|
|
|
726
740
|
/**
|
|
727
741
|
* Caps at `512` the supported nesting depth of a compiled contract shape, frozen.
|
|
@@ -1709,6 +1723,51 @@ export declare function enumerableSymbolCount(value: object): number;
|
|
|
1709
1723
|
*/
|
|
1710
1724
|
export declare function enumOf<const E extends Record<string, string | number>>(enumeration: E): Guard<E[keyof E]>;
|
|
1711
1725
|
|
|
1726
|
+
/**
|
|
1727
|
+
* Renders a thrown value as a non-empty message.
|
|
1728
|
+
*
|
|
1729
|
+
* @remarks
|
|
1730
|
+
* Reads an `Error`'s `message` and converts any other value with the `String`
|
|
1731
|
+
* function {@link INTRINSICS} captured at load, so a symbol renders as
|
|
1732
|
+
* `Symbol(description)` and a caller that replaces the global `String` does not
|
|
1733
|
+
* change the result. Returns `'unknown failure'` when
|
|
1734
|
+
* that read throws, as a throwing `message` getter or `toString` method does,
|
|
1735
|
+
* when an `Error`'s `message` is not a string, and when the rendered text is
|
|
1736
|
+
* empty. Never throws.
|
|
1737
|
+
*
|
|
1738
|
+
* @param error - The caught value, of any shape
|
|
1739
|
+
* @returns The rendered message, never empty
|
|
1740
|
+
*
|
|
1741
|
+
* @example
|
|
1742
|
+
* ```ts
|
|
1743
|
+
* errorToMessage(new Error('boom')) // 'boom'
|
|
1744
|
+
* errorToMessage('') // 'unknown failure'
|
|
1745
|
+
* ```
|
|
1746
|
+
*/
|
|
1747
|
+
export declare function errorToMessage(error: unknown): string;
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
* Escapes every regular-expression metacharacter in a text, so the text
|
|
1751
|
+
* matches literally inside a larger `RegExp` source.
|
|
1752
|
+
*
|
|
1753
|
+
* @remarks
|
|
1754
|
+
* Prefixes each of `\ ^ $ . * + ? ( ) [ ] { } |` with a backslash and leaves
|
|
1755
|
+
* every other character, `-` and `/` included, unchanged; the empty string
|
|
1756
|
+
* returns unchanged. The escape is an INDEXED character map rather than
|
|
1757
|
+
* `String.prototype.replace`, which dispatches through the caller-writable
|
|
1758
|
+
* `RegExp.prototype[Symbol.replace]` and `exec` members.
|
|
1759
|
+
*
|
|
1760
|
+
* @param value - The literal text to escape
|
|
1761
|
+
* @returns The text with every metacharacter backslash-escaped
|
|
1762
|
+
*
|
|
1763
|
+
* @example
|
|
1764
|
+
* ```ts
|
|
1765
|
+
* escapeRegExp('a.b*c') // 'a\\.b\\*c'
|
|
1766
|
+
* new RegExp(`^${escapeRegExp('a.b')}$`).test('axb') // false
|
|
1767
|
+
* ```
|
|
1768
|
+
*/
|
|
1769
|
+
export declare function escapeRegExp(value: string): string;
|
|
1770
|
+
|
|
1712
1771
|
/** Evaluates a compiled node at one diagnostic path. */
|
|
1713
1772
|
export declare type EvaluationFunction<T> = (value: unknown, path: readonly string[]) => T;
|
|
1714
1773
|
|
|
@@ -1735,6 +1794,19 @@ export declare interface Failure<E> {
|
|
|
1735
1794
|
readonly error: E;
|
|
1736
1795
|
}
|
|
1737
1796
|
|
|
1797
|
+
/**
|
|
1798
|
+
* Boxes an error as the {@link Failure} branch of a {@link Result}.
|
|
1799
|
+
*
|
|
1800
|
+
* @param error - The error to box, retained exactly
|
|
1801
|
+
* @returns A fresh `{ success: false, error }` record
|
|
1802
|
+
*
|
|
1803
|
+
* @example
|
|
1804
|
+
* ```ts
|
|
1805
|
+
* failure('offline') // { success: false, error: 'offline' }
|
|
1806
|
+
* ```
|
|
1807
|
+
*/
|
|
1808
|
+
export declare function failure<E>(error: E): Failure<E>;
|
|
1809
|
+
|
|
1738
1810
|
/**
|
|
1739
1811
|
* Represents a single structured parse-failure diagnostic — one entry of an
|
|
1740
1812
|
* {@link ContractInterface.explain} report.
|
|
@@ -2866,6 +2938,19 @@ export declare function isEmptyString(value: unknown): value is '';
|
|
|
2866
2938
|
*/
|
|
2867
2939
|
export declare function isError(value: unknown): value is Error;
|
|
2868
2940
|
|
|
2941
|
+
/**
|
|
2942
|
+
* Narrows a {@link Result} to its {@link Failure} branch.
|
|
2943
|
+
*
|
|
2944
|
+
* @param result - The result to narrow
|
|
2945
|
+
* @returns True if the result failed; false otherwise
|
|
2946
|
+
*
|
|
2947
|
+
* @example
|
|
2948
|
+
* ```ts
|
|
2949
|
+
* isFailure(failure('offline')) // true
|
|
2950
|
+
* ```
|
|
2951
|
+
*/
|
|
2952
|
+
export declare function isFailure<T, E>(result: Result<T, E>): result is Failure<E>;
|
|
2953
|
+
|
|
2869
2954
|
/** Determines whether a value is exactly `false`.
|
|
2870
2955
|
*
|
|
2871
2956
|
* @param value - The value to inspect
|
|
@@ -3465,6 +3550,19 @@ export declare function isSharedArrayBuffer(value: unknown): value is SharedArra
|
|
|
3465
3550
|
*/
|
|
3466
3551
|
export declare function isString(value: unknown): value is string;
|
|
3467
3552
|
|
|
3553
|
+
/**
|
|
3554
|
+
* Narrows a {@link Result} to its {@link Success} branch.
|
|
3555
|
+
*
|
|
3556
|
+
* @param result - The result to narrow
|
|
3557
|
+
* @returns True if the result succeeded; false otherwise
|
|
3558
|
+
*
|
|
3559
|
+
* @example
|
|
3560
|
+
* ```ts
|
|
3561
|
+
* isSuccess(success(1)) // true
|
|
3562
|
+
* ```
|
|
3563
|
+
*/
|
|
3564
|
+
export declare function isSuccess<T, E>(result: Result<T, E>): result is Success<T>;
|
|
3565
|
+
|
|
3468
3566
|
/** Determines whether a value is a symbol.
|
|
3469
3567
|
*
|
|
3470
3568
|
* @param value - The value to inspect
|
|
@@ -4270,6 +4368,34 @@ export declare function matchesVisited(visited: WeakSet<object>, value: object):
|
|
|
4270
4368
|
*/
|
|
4271
4369
|
export declare function matchOf(pattern: RegExp): Guard<string>;
|
|
4272
4370
|
|
|
4371
|
+
/**
|
|
4372
|
+
* Caps at `128` the length, in UTF-16 code units, of one name a schema declares, frozen:
|
|
4373
|
+
* a schema, group, or field name, or a column key.
|
|
4374
|
+
*
|
|
4375
|
+
* @remarks
|
|
4376
|
+
* A retention limit that a declaring package enforces, as {@link CHOICE_LIMIT} states.
|
|
4377
|
+
*
|
|
4378
|
+
* @example
|
|
4379
|
+
* ```ts
|
|
4380
|
+
* NAME_LIMIT // 128
|
|
4381
|
+
* ```
|
|
4382
|
+
*/
|
|
4383
|
+
export declare const NAME_LIMIT = 128;
|
|
4384
|
+
|
|
4385
|
+
/**
|
|
4386
|
+
* Caps at `16384` the total number of records, arrays, and leaves one schema retains,
|
|
4387
|
+
* frozen.
|
|
4388
|
+
*
|
|
4389
|
+
* @remarks
|
|
4390
|
+
* A retention limit that a declaring package enforces, as {@link CHOICE_LIMIT} states.
|
|
4391
|
+
*
|
|
4392
|
+
* @example
|
|
4393
|
+
* ```ts
|
|
4394
|
+
* NODE_LIMIT // 16384
|
|
4395
|
+
* ```
|
|
4396
|
+
*/
|
|
4397
|
+
export declare const NODE_LIMIT = 16384;
|
|
4398
|
+
|
|
4273
4399
|
/**
|
|
4274
4400
|
* Negates a guard or predicate — passes when `guard` returns `false`.
|
|
4275
4401
|
*
|
|
@@ -6399,7 +6525,7 @@ export declare interface ShapeValidatorInterface {
|
|
|
6399
6525
|
* `valueToSchema({ b: 1, a: 2 })` publish `{"type":"object","additionalProperties":false}`
|
|
6400
6526
|
* — a successful answer with the caller's properties silently gone. The copy is
|
|
6401
6527
|
* taken first so a caller-owned array is never reordered in place, and the order
|
|
6402
|
-
* is decided by {@link
|
|
6528
|
+
* is decided by {@link comparePrimitives}, whose `<` / `>` comparison dispatches
|
|
6403
6529
|
* through nothing.
|
|
6404
6530
|
*
|
|
6405
6531
|
* @param values - The keys or indices to order
|
|
@@ -6412,6 +6538,20 @@ export declare interface ShapeValidatorInterface {
|
|
|
6412
6538
|
*/
|
|
6413
6539
|
export declare function sortValues<T extends string | number>(values: readonly T[]): readonly T[];
|
|
6414
6540
|
|
|
6541
|
+
/**
|
|
6542
|
+
* Caps at `65536` the length, in UTF-16 code units, of any single string one schema
|
|
6543
|
+
* retains, frozen.
|
|
6544
|
+
*
|
|
6545
|
+
* @remarks
|
|
6546
|
+
* A retention limit that a declaring package enforces, as {@link CHOICE_LIMIT} states.
|
|
6547
|
+
*
|
|
6548
|
+
* @example
|
|
6549
|
+
* ```ts
|
|
6550
|
+
* STRING_LIMIT // 65536
|
|
6551
|
+
* ```
|
|
6552
|
+
*/
|
|
6553
|
+
export declare const STRING_LIMIT = 65536;
|
|
6554
|
+
|
|
6415
6555
|
/**
|
|
6416
6556
|
* Groups the options for the `stringOf` guard builder.
|
|
6417
6557
|
*
|
|
@@ -6532,6 +6672,33 @@ export declare interface Success<T> {
|
|
|
6532
6672
|
readonly value: T;
|
|
6533
6673
|
}
|
|
6534
6674
|
|
|
6675
|
+
/**
|
|
6676
|
+
* Boxes a value as the {@link Success} branch of a {@link Result}.
|
|
6677
|
+
*
|
|
6678
|
+
* @param value - The value to box, retained exactly
|
|
6679
|
+
* @returns A fresh `{ success: true, value }` record
|
|
6680
|
+
*
|
|
6681
|
+
* @example
|
|
6682
|
+
* ```ts
|
|
6683
|
+
* success(42) // { success: true, value: 42 }
|
|
6684
|
+
* ```
|
|
6685
|
+
*/
|
|
6686
|
+
export declare function success<T>(value: T): Success<T>;
|
|
6687
|
+
|
|
6688
|
+
/**
|
|
6689
|
+
* Caps at `1048576` the total length, in UTF-16 code units, of every string one schema
|
|
6690
|
+
* retains, frozen.
|
|
6691
|
+
*
|
|
6692
|
+
* @remarks
|
|
6693
|
+
* A retention limit that a declaring package enforces, as {@link CHOICE_LIMIT} states.
|
|
6694
|
+
*
|
|
6695
|
+
* @example
|
|
6696
|
+
* ```ts
|
|
6697
|
+
* TEXT_LIMIT // 1048576
|
|
6698
|
+
* ```
|
|
6699
|
+
*/
|
|
6700
|
+
export declare const TEXT_LIMIT = 1048576;
|
|
6701
|
+
|
|
6535
6702
|
/**
|
|
6536
6703
|
* Builds a guard that passes when the base passes AND the projection of the value
|
|
6537
6704
|
* satisfies the target guard. Still narrows to `T` (the base type) — the target
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -199,7 +199,7 @@ export declare interface ArrayShapeOptions {
|
|
|
199
199
|
* @example
|
|
200
200
|
* ```ts
|
|
201
201
|
* const outcome = attempt(() => predicate(value))
|
|
202
|
-
* return outcome
|
|
202
|
+
* return isSuccess(outcome) && outcome.value
|
|
203
203
|
* ```
|
|
204
204
|
*/
|
|
205
205
|
export declare function attempt<T>(callback: () => T): Result<T>;
|
|
@@ -476,6 +476,20 @@ export declare function buildStringFaults(shape: StringShape, value: string, pat
|
|
|
476
476
|
*/
|
|
477
477
|
export declare function canonicalStringify(value: unknown): string | undefined;
|
|
478
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Caps at `1024` the number of choices one schema field may offer, frozen.
|
|
481
|
+
*
|
|
482
|
+
* @remarks
|
|
483
|
+
* A retention limit that a declaring package, such as a form or table schema
|
|
484
|
+
* package, enforces; this package enforces none of the retention limits itself.
|
|
485
|
+
*
|
|
486
|
+
* @example
|
|
487
|
+
* ```ts
|
|
488
|
+
* CHOICE_LIMIT // 1024
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
export declare const CHOICE_LIMIT = 1024;
|
|
492
|
+
|
|
479
493
|
/**
|
|
480
494
|
* Classifies an already-bounded string against the pattern-only and
|
|
481
495
|
* calendar-checked {@link SchemaFormat} vocabulary.
|
|
@@ -646,7 +660,7 @@ export declare function cloneShape(shape: ContractShape): ContractShape;
|
|
|
646
660
|
*
|
|
647
661
|
* @remarks
|
|
648
662
|
* Extracted rather than written inline for the same reason
|
|
649
|
-
* {@link
|
|
663
|
+
* {@link comparePrimitives} is: `Reflect.apply` takes its arguments as a LIST, so an
|
|
650
664
|
* inline collector is a function expression inside an array literal rather than
|
|
651
665
|
* one passed directly as an argument — a hidden function assignment this
|
|
652
666
|
* repository forbids wherever it appears. Returned directly from a factory it is
|
|
@@ -718,10 +732,10 @@ export declare function collectMembers(values: readonly unknown[]): Set<unknown>
|
|
|
718
732
|
*
|
|
719
733
|
* @example
|
|
720
734
|
* ```ts
|
|
721
|
-
*
|
|
735
|
+
* comparePrimitives('a', 'b') // -1
|
|
722
736
|
* ```
|
|
723
737
|
*/
|
|
724
|
-
export declare function
|
|
738
|
+
export declare function comparePrimitives<T extends string | number>(left: T, right: T): number;
|
|
725
739
|
|
|
726
740
|
/**
|
|
727
741
|
* Caps at `512` the supported nesting depth of a compiled contract shape, frozen.
|
|
@@ -1709,6 +1723,51 @@ export declare function enumerableSymbolCount(value: object): number;
|
|
|
1709
1723
|
*/
|
|
1710
1724
|
export declare function enumOf<const E extends Record<string, string | number>>(enumeration: E): Guard<E[keyof E]>;
|
|
1711
1725
|
|
|
1726
|
+
/**
|
|
1727
|
+
* Renders a thrown value as a non-empty message.
|
|
1728
|
+
*
|
|
1729
|
+
* @remarks
|
|
1730
|
+
* Reads an `Error`'s `message` and converts any other value with the `String`
|
|
1731
|
+
* function {@link INTRINSICS} captured at load, so a symbol renders as
|
|
1732
|
+
* `Symbol(description)` and a caller that replaces the global `String` does not
|
|
1733
|
+
* change the result. Returns `'unknown failure'` when
|
|
1734
|
+
* that read throws, as a throwing `message` getter or `toString` method does,
|
|
1735
|
+
* when an `Error`'s `message` is not a string, and when the rendered text is
|
|
1736
|
+
* empty. Never throws.
|
|
1737
|
+
*
|
|
1738
|
+
* @param error - The caught value, of any shape
|
|
1739
|
+
* @returns The rendered message, never empty
|
|
1740
|
+
*
|
|
1741
|
+
* @example
|
|
1742
|
+
* ```ts
|
|
1743
|
+
* errorToMessage(new Error('boom')) // 'boom'
|
|
1744
|
+
* errorToMessage('') // 'unknown failure'
|
|
1745
|
+
* ```
|
|
1746
|
+
*/
|
|
1747
|
+
export declare function errorToMessage(error: unknown): string;
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
* Escapes every regular-expression metacharacter in a text, so the text
|
|
1751
|
+
* matches literally inside a larger `RegExp` source.
|
|
1752
|
+
*
|
|
1753
|
+
* @remarks
|
|
1754
|
+
* Prefixes each of `\ ^ $ . * + ? ( ) [ ] { } |` with a backslash and leaves
|
|
1755
|
+
* every other character, `-` and `/` included, unchanged; the empty string
|
|
1756
|
+
* returns unchanged. The escape is an INDEXED character map rather than
|
|
1757
|
+
* `String.prototype.replace`, which dispatches through the caller-writable
|
|
1758
|
+
* `RegExp.prototype[Symbol.replace]` and `exec` members.
|
|
1759
|
+
*
|
|
1760
|
+
* @param value - The literal text to escape
|
|
1761
|
+
* @returns The text with every metacharacter backslash-escaped
|
|
1762
|
+
*
|
|
1763
|
+
* @example
|
|
1764
|
+
* ```ts
|
|
1765
|
+
* escapeRegExp('a.b*c') // 'a\\.b\\*c'
|
|
1766
|
+
* new RegExp(`^${escapeRegExp('a.b')}$`).test('axb') // false
|
|
1767
|
+
* ```
|
|
1768
|
+
*/
|
|
1769
|
+
export declare function escapeRegExp(value: string): string;
|
|
1770
|
+
|
|
1712
1771
|
/** Evaluates a compiled node at one diagnostic path. */
|
|
1713
1772
|
export declare type EvaluationFunction<T> = (value: unknown, path: readonly string[]) => T;
|
|
1714
1773
|
|
|
@@ -1735,6 +1794,19 @@ export declare interface Failure<E> {
|
|
|
1735
1794
|
readonly error: E;
|
|
1736
1795
|
}
|
|
1737
1796
|
|
|
1797
|
+
/**
|
|
1798
|
+
* Boxes an error as the {@link Failure} branch of a {@link Result}.
|
|
1799
|
+
*
|
|
1800
|
+
* @param error - The error to box, retained exactly
|
|
1801
|
+
* @returns A fresh `{ success: false, error }` record
|
|
1802
|
+
*
|
|
1803
|
+
* @example
|
|
1804
|
+
* ```ts
|
|
1805
|
+
* failure('offline') // { success: false, error: 'offline' }
|
|
1806
|
+
* ```
|
|
1807
|
+
*/
|
|
1808
|
+
export declare function failure<E>(error: E): Failure<E>;
|
|
1809
|
+
|
|
1738
1810
|
/**
|
|
1739
1811
|
* Represents a single structured parse-failure diagnostic — one entry of an
|
|
1740
1812
|
* {@link ContractInterface.explain} report.
|
|
@@ -2866,6 +2938,19 @@ export declare function isEmptyString(value: unknown): value is '';
|
|
|
2866
2938
|
*/
|
|
2867
2939
|
export declare function isError(value: unknown): value is Error;
|
|
2868
2940
|
|
|
2941
|
+
/**
|
|
2942
|
+
* Narrows a {@link Result} to its {@link Failure} branch.
|
|
2943
|
+
*
|
|
2944
|
+
* @param result - The result to narrow
|
|
2945
|
+
* @returns True if the result failed; false otherwise
|
|
2946
|
+
*
|
|
2947
|
+
* @example
|
|
2948
|
+
* ```ts
|
|
2949
|
+
* isFailure(failure('offline')) // true
|
|
2950
|
+
* ```
|
|
2951
|
+
*/
|
|
2952
|
+
export declare function isFailure<T, E>(result: Result<T, E>): result is Failure<E>;
|
|
2953
|
+
|
|
2869
2954
|
/** Determines whether a value is exactly `false`.
|
|
2870
2955
|
*
|
|
2871
2956
|
* @param value - The value to inspect
|
|
@@ -3465,6 +3550,19 @@ export declare function isSharedArrayBuffer(value: unknown): value is SharedArra
|
|
|
3465
3550
|
*/
|
|
3466
3551
|
export declare function isString(value: unknown): value is string;
|
|
3467
3552
|
|
|
3553
|
+
/**
|
|
3554
|
+
* Narrows a {@link Result} to its {@link Success} branch.
|
|
3555
|
+
*
|
|
3556
|
+
* @param result - The result to narrow
|
|
3557
|
+
* @returns True if the result succeeded; false otherwise
|
|
3558
|
+
*
|
|
3559
|
+
* @example
|
|
3560
|
+
* ```ts
|
|
3561
|
+
* isSuccess(success(1)) // true
|
|
3562
|
+
* ```
|
|
3563
|
+
*/
|
|
3564
|
+
export declare function isSuccess<T, E>(result: Result<T, E>): result is Success<T>;
|
|
3565
|
+
|
|
3468
3566
|
/** Determines whether a value is a symbol.
|
|
3469
3567
|
*
|
|
3470
3568
|
* @param value - The value to inspect
|
|
@@ -4270,6 +4368,34 @@ export declare function matchesVisited(visited: WeakSet<object>, value: object):
|
|
|
4270
4368
|
*/
|
|
4271
4369
|
export declare function matchOf(pattern: RegExp): Guard<string>;
|
|
4272
4370
|
|
|
4371
|
+
/**
|
|
4372
|
+
* Caps at `128` the length, in UTF-16 code units, of one name a schema declares, frozen:
|
|
4373
|
+
* a schema, group, or field name, or a column key.
|
|
4374
|
+
*
|
|
4375
|
+
* @remarks
|
|
4376
|
+
* A retention limit that a declaring package enforces, as {@link CHOICE_LIMIT} states.
|
|
4377
|
+
*
|
|
4378
|
+
* @example
|
|
4379
|
+
* ```ts
|
|
4380
|
+
* NAME_LIMIT // 128
|
|
4381
|
+
* ```
|
|
4382
|
+
*/
|
|
4383
|
+
export declare const NAME_LIMIT = 128;
|
|
4384
|
+
|
|
4385
|
+
/**
|
|
4386
|
+
* Caps at `16384` the total number of records, arrays, and leaves one schema retains,
|
|
4387
|
+
* frozen.
|
|
4388
|
+
*
|
|
4389
|
+
* @remarks
|
|
4390
|
+
* A retention limit that a declaring package enforces, as {@link CHOICE_LIMIT} states.
|
|
4391
|
+
*
|
|
4392
|
+
* @example
|
|
4393
|
+
* ```ts
|
|
4394
|
+
* NODE_LIMIT // 16384
|
|
4395
|
+
* ```
|
|
4396
|
+
*/
|
|
4397
|
+
export declare const NODE_LIMIT = 16384;
|
|
4398
|
+
|
|
4273
4399
|
/**
|
|
4274
4400
|
* Negates a guard or predicate — passes when `guard` returns `false`.
|
|
4275
4401
|
*
|
|
@@ -6399,7 +6525,7 @@ export declare interface ShapeValidatorInterface {
|
|
|
6399
6525
|
* `valueToSchema({ b: 1, a: 2 })` publish `{"type":"object","additionalProperties":false}`
|
|
6400
6526
|
* — a successful answer with the caller's properties silently gone. The copy is
|
|
6401
6527
|
* taken first so a caller-owned array is never reordered in place, and the order
|
|
6402
|
-
* is decided by {@link
|
|
6528
|
+
* is decided by {@link comparePrimitives}, whose `<` / `>` comparison dispatches
|
|
6403
6529
|
* through nothing.
|
|
6404
6530
|
*
|
|
6405
6531
|
* @param values - The keys or indices to order
|
|
@@ -6412,6 +6538,20 @@ export declare interface ShapeValidatorInterface {
|
|
|
6412
6538
|
*/
|
|
6413
6539
|
export declare function sortValues<T extends string | number>(values: readonly T[]): readonly T[];
|
|
6414
6540
|
|
|
6541
|
+
/**
|
|
6542
|
+
* Caps at `65536` the length, in UTF-16 code units, of any single string one schema
|
|
6543
|
+
* retains, frozen.
|
|
6544
|
+
*
|
|
6545
|
+
* @remarks
|
|
6546
|
+
* A retention limit that a declaring package enforces, as {@link CHOICE_LIMIT} states.
|
|
6547
|
+
*
|
|
6548
|
+
* @example
|
|
6549
|
+
* ```ts
|
|
6550
|
+
* STRING_LIMIT // 65536
|
|
6551
|
+
* ```
|
|
6552
|
+
*/
|
|
6553
|
+
export declare const STRING_LIMIT = 65536;
|
|
6554
|
+
|
|
6415
6555
|
/**
|
|
6416
6556
|
* Groups the options for the `stringOf` guard builder.
|
|
6417
6557
|
*
|
|
@@ -6532,6 +6672,33 @@ export declare interface Success<T> {
|
|
|
6532
6672
|
readonly value: T;
|
|
6533
6673
|
}
|
|
6534
6674
|
|
|
6675
|
+
/**
|
|
6676
|
+
* Boxes a value as the {@link Success} branch of a {@link Result}.
|
|
6677
|
+
*
|
|
6678
|
+
* @param value - The value to box, retained exactly
|
|
6679
|
+
* @returns A fresh `{ success: true, value }` record
|
|
6680
|
+
*
|
|
6681
|
+
* @example
|
|
6682
|
+
* ```ts
|
|
6683
|
+
* success(42) // { success: true, value: 42 }
|
|
6684
|
+
* ```
|
|
6685
|
+
*/
|
|
6686
|
+
export declare function success<T>(value: T): Success<T>;
|
|
6687
|
+
|
|
6688
|
+
/**
|
|
6689
|
+
* Caps at `1048576` the total length, in UTF-16 code units, of every string one schema
|
|
6690
|
+
* retains, frozen.
|
|
6691
|
+
*
|
|
6692
|
+
* @remarks
|
|
6693
|
+
* A retention limit that a declaring package enforces, as {@link CHOICE_LIMIT} states.
|
|
6694
|
+
*
|
|
6695
|
+
* @example
|
|
6696
|
+
* ```ts
|
|
6697
|
+
* TEXT_LIMIT // 1048576
|
|
6698
|
+
* ```
|
|
6699
|
+
*/
|
|
6700
|
+
export declare const TEXT_LIMIT = 1048576;
|
|
6701
|
+
|
|
6535
6702
|
/**
|
|
6536
6703
|
* Builds a guard that passes when the base passes AND the projection of the value
|
|
6537
6704
|
* satisfies the target guard. Still narrows to `T` (the base type) — the target
|