@orkestrel/contract 0.0.26 → 0.0.28
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 +245 -136
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +41 -7
- package/dist/src/core/index.d.ts +41 -7
- package/dist/src/core/index.js +245 -137
- package/dist/src/core/index.js.map +1 -1
- package/package.json +11 -11
|
@@ -353,6 +353,27 @@ export declare interface BoundsRead {
|
|
|
353
353
|
*/
|
|
354
354
|
export declare function buildArrayFaults(shape: ArrayShape, length: number, path: readonly string[]): readonly Fault[];
|
|
355
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Builds a child's path from a dense path this package built and the child's key, without
|
|
358
|
+
* dispatching through array iteration.
|
|
359
|
+
*
|
|
360
|
+
* @remarks
|
|
361
|
+
* Reads `length` once and each segment once, in order, through a null-prototype array-like
|
|
362
|
+
* that reaches no iterator and no caller member. A caller's path goes through {@link pathOf}
|
|
363
|
+
* instead, which rereads its length before every segment and omits an absent one.
|
|
364
|
+
*
|
|
365
|
+
* @param path - A dense path this package built
|
|
366
|
+
* @param key - The child's key
|
|
367
|
+
* @returns A fresh path carrying every segment and then the key
|
|
368
|
+
* @throws An `Error` when `path` holds an absent segment
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* ```ts
|
|
372
|
+
* buildChildPath(['user'], 'name') // ['user', 'name']
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
export declare function buildChildPath(path: readonly string[], key: string): readonly string[];
|
|
376
|
+
|
|
356
377
|
/**
|
|
357
378
|
* Builds the key plan that answers one key order from the declared member guards.
|
|
358
379
|
*
|
|
@@ -2119,8 +2140,13 @@ export declare function escapeControls(text: string): string;
|
|
|
2119
2140
|
*/
|
|
2120
2141
|
export declare function escapeRegExp(value: string): string;
|
|
2121
2142
|
|
|
2122
|
-
/**
|
|
2123
|
-
|
|
2143
|
+
/**
|
|
2144
|
+
* Evaluates a compiled node at one diagnostic path.
|
|
2145
|
+
*
|
|
2146
|
+
* @remarks
|
|
2147
|
+
* `built` is true when this package built `path`, and absent or false for a caller's path.
|
|
2148
|
+
*/
|
|
2149
|
+
export declare type EvaluationFunction<T> = (value: unknown, path: readonly string[], built?: boolean) => T;
|
|
2124
2150
|
|
|
2125
2151
|
/**
|
|
2126
2152
|
* Extracts a schema's forms: the schema itself, then its union arms, so a read looks
|
|
@@ -3266,6 +3292,12 @@ export declare const INTRINSICS: Readonly<{
|
|
|
3266
3292
|
sweep: (callbackfn: (value: any, value2: any, set: Set<any>) => void, thisArg?: any) => void;
|
|
3267
3293
|
/** Captures `Set.prototype.delete` — settlement of an active operation. */
|
|
3268
3294
|
remove: (value: any) => boolean;
|
|
3295
|
+
/** Captures the `Set.prototype.size` getter — the emptiness answer of a registry this package built, dispatched through `apply`. */
|
|
3296
|
+
count: (() => any) | undefined;
|
|
3297
|
+
/** Captures `Set.prototype.values` — an ordered cursor over a registry this package built, dispatched through `apply`. */
|
|
3298
|
+
cursor: () => SetIterator<any>;
|
|
3299
|
+
/** Captures the native set iterator advance operation. */
|
|
3300
|
+
step: any;
|
|
3269
3301
|
/** Captures `WeakMap` — object-keyed working state. */
|
|
3270
3302
|
weakMap: WeakMapConstructor;
|
|
3271
3303
|
/** Captures `WeakMap.prototype.get` — an object-keyed memo read a published graph embeds, dispatched through `apply`. */
|
|
@@ -5337,8 +5369,9 @@ export declare function matchesRecordBrand(value: unknown): boolean;
|
|
|
5337
5369
|
* Checks whether the member of the record bound as `this` passes a key-plan step's guard.
|
|
5338
5370
|
*
|
|
5339
5371
|
* @remarks
|
|
5340
|
-
*
|
|
5341
|
-
*
|
|
5372
|
+
* Answers one step of the walk a compiled closed-object guard makes over a kept key plan, for a
|
|
5373
|
+
* caller that passes it with the record as the `thisArg` argument to an `every` walk over the plan,
|
|
5374
|
+
* which reads each member once, in the plan's order, and stops at the first refusal.
|
|
5342
5375
|
*
|
|
5343
5376
|
* @param step - The step whose member to read and guard
|
|
5344
5377
|
* @returns True if the member under the step's key passes its guard; false otherwise
|
|
@@ -5354,7 +5387,8 @@ export declare function matchesStepGuard(this: Readonly<Record<string, unknown>>
|
|
|
5354
5387
|
* Checks whether a key-plan step names the key at its index in the list bound as `this`.
|
|
5355
5388
|
*
|
|
5356
5389
|
* @remarks
|
|
5357
|
-
*
|
|
5390
|
+
* Answers one step of the comparison {@link matchesKeyPlan} makes, for a caller that passes it with
|
|
5391
|
+
* the key list as the `thisArg` argument to an `every` walk over a key plan.
|
|
5358
5392
|
*
|
|
5359
5393
|
* @param step - The step to compare
|
|
5360
5394
|
* @param index - The step's position in its plan
|
|
@@ -6828,8 +6862,8 @@ export declare function readPatternSource(pattern: unknown): string | undefined;
|
|
|
6828
6862
|
* Derives the bit mask of names present in an indexed lookup.
|
|
6829
6863
|
*
|
|
6830
6864
|
* @remarks
|
|
6831
|
-
* Takes `names` as the array it declares
|
|
6832
|
-
*
|
|
6865
|
+
* Takes `names` as the array it declares, reads its length once, and reads each present
|
|
6866
|
+
* index once, in order, so a hole adds no bit and is never read. An array-like that is not an array
|
|
6833
6867
|
* is outside this contract.
|
|
6834
6868
|
*
|
|
6835
6869
|
* @param names - Names to observe in order
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -353,6 +353,27 @@ export declare interface BoundsRead {
|
|
|
353
353
|
*/
|
|
354
354
|
export declare function buildArrayFaults(shape: ArrayShape, length: number, path: readonly string[]): readonly Fault[];
|
|
355
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Builds a child's path from a dense path this package built and the child's key, without
|
|
358
|
+
* dispatching through array iteration.
|
|
359
|
+
*
|
|
360
|
+
* @remarks
|
|
361
|
+
* Reads `length` once and each segment once, in order, through a null-prototype array-like
|
|
362
|
+
* that reaches no iterator and no caller member. A caller's path goes through {@link pathOf}
|
|
363
|
+
* instead, which rereads its length before every segment and omits an absent one.
|
|
364
|
+
*
|
|
365
|
+
* @param path - A dense path this package built
|
|
366
|
+
* @param key - The child's key
|
|
367
|
+
* @returns A fresh path carrying every segment and then the key
|
|
368
|
+
* @throws An `Error` when `path` holds an absent segment
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* ```ts
|
|
372
|
+
* buildChildPath(['user'], 'name') // ['user', 'name']
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
export declare function buildChildPath(path: readonly string[], key: string): readonly string[];
|
|
376
|
+
|
|
356
377
|
/**
|
|
357
378
|
* Builds the key plan that answers one key order from the declared member guards.
|
|
358
379
|
*
|
|
@@ -2119,8 +2140,13 @@ export declare function escapeControls(text: string): string;
|
|
|
2119
2140
|
*/
|
|
2120
2141
|
export declare function escapeRegExp(value: string): string;
|
|
2121
2142
|
|
|
2122
|
-
/**
|
|
2123
|
-
|
|
2143
|
+
/**
|
|
2144
|
+
* Evaluates a compiled node at one diagnostic path.
|
|
2145
|
+
*
|
|
2146
|
+
* @remarks
|
|
2147
|
+
* `built` is true when this package built `path`, and absent or false for a caller's path.
|
|
2148
|
+
*/
|
|
2149
|
+
export declare type EvaluationFunction<T> = (value: unknown, path: readonly string[], built?: boolean) => T;
|
|
2124
2150
|
|
|
2125
2151
|
/**
|
|
2126
2152
|
* Extracts a schema's forms: the schema itself, then its union arms, so a read looks
|
|
@@ -3266,6 +3292,12 @@ export declare const INTRINSICS: Readonly<{
|
|
|
3266
3292
|
sweep: (callbackfn: (value: any, value2: any, set: Set<any>) => void, thisArg?: any) => void;
|
|
3267
3293
|
/** Captures `Set.prototype.delete` — settlement of an active operation. */
|
|
3268
3294
|
remove: (value: any) => boolean;
|
|
3295
|
+
/** Captures the `Set.prototype.size` getter — the emptiness answer of a registry this package built, dispatched through `apply`. */
|
|
3296
|
+
count: (() => any) | undefined;
|
|
3297
|
+
/** Captures `Set.prototype.values` — an ordered cursor over a registry this package built, dispatched through `apply`. */
|
|
3298
|
+
cursor: () => SetIterator<any>;
|
|
3299
|
+
/** Captures the native set iterator advance operation. */
|
|
3300
|
+
step: any;
|
|
3269
3301
|
/** Captures `WeakMap` — object-keyed working state. */
|
|
3270
3302
|
weakMap: WeakMapConstructor;
|
|
3271
3303
|
/** Captures `WeakMap.prototype.get` — an object-keyed memo read a published graph embeds, dispatched through `apply`. */
|
|
@@ -5337,8 +5369,9 @@ export declare function matchesRecordBrand(value: unknown): boolean;
|
|
|
5337
5369
|
* Checks whether the member of the record bound as `this` passes a key-plan step's guard.
|
|
5338
5370
|
*
|
|
5339
5371
|
* @remarks
|
|
5340
|
-
*
|
|
5341
|
-
*
|
|
5372
|
+
* Answers one step of the walk a compiled closed-object guard makes over a kept key plan, for a
|
|
5373
|
+
* caller that passes it with the record as the `thisArg` argument to an `every` walk over the plan,
|
|
5374
|
+
* which reads each member once, in the plan's order, and stops at the first refusal.
|
|
5342
5375
|
*
|
|
5343
5376
|
* @param step - The step whose member to read and guard
|
|
5344
5377
|
* @returns True if the member under the step's key passes its guard; false otherwise
|
|
@@ -5354,7 +5387,8 @@ export declare function matchesStepGuard(this: Readonly<Record<string, unknown>>
|
|
|
5354
5387
|
* Checks whether a key-plan step names the key at its index in the list bound as `this`.
|
|
5355
5388
|
*
|
|
5356
5389
|
* @remarks
|
|
5357
|
-
*
|
|
5390
|
+
* Answers one step of the comparison {@link matchesKeyPlan} makes, for a caller that passes it with
|
|
5391
|
+
* the key list as the `thisArg` argument to an `every` walk over a key plan.
|
|
5358
5392
|
*
|
|
5359
5393
|
* @param step - The step to compare
|
|
5360
5394
|
* @param index - The step's position in its plan
|
|
@@ -6828,8 +6862,8 @@ export declare function readPatternSource(pattern: unknown): string | undefined;
|
|
|
6828
6862
|
* Derives the bit mask of names present in an indexed lookup.
|
|
6829
6863
|
*
|
|
6830
6864
|
* @remarks
|
|
6831
|
-
* Takes `names` as the array it declares
|
|
6832
|
-
*
|
|
6865
|
+
* Takes `names` as the array it declares, reads its length once, and reads each present
|
|
6866
|
+
* index once, in order, so a hole adds no bit and is never read. An array-like that is not an array
|
|
6833
6867
|
* is outside this contract.
|
|
6834
6868
|
*
|
|
6835
6869
|
* @param names - Names to observe in order
|