FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

9
node_modules/superstruct/License.md generated vendored Normal file
View File

@@ -0,0 +1,9 @@
The MIT License
Copyright &copy; 2017, [Ian Storm Taylor](https://ianstormtaylor.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

230
node_modules/superstruct/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,230 @@
<p align="center">
<a href="#"><img src="./docs/images/banner.png" /></a>
</p>
<p align="center">
A simple and composable way <br/>
to validate data in JavaScript (and TypeScript).
</p>
<br/>
<br/>
<p align="center">
<a href="#usage">Usage</a> •
<a href="#why">Why?</a> •
<a href="#principles">Principles</a> •
<a href="#demo">Demo</a> •
<a href="#examples">Examples</a> •
<a href="#documentation">Documentation</a>
</p>
<p align="center">
<a href="https://unpkg.com/superstruct/umd/superstruct.min.js">
<img src="https://badgen.net/bundlephobia/minzip/superstruct?color=green&label=size">
</a>
<a href="./package.json">
<img src="https://badgen.net/npm/v/superstruct?color=blue&label=version">
</a>
</p>
<br/>
<br/>
Superstruct makes it easy to define interfaces and then validate JavaScript data against them. Its type annotation API was inspired by [Typescript](https://www.typescriptlang.org/docs/handbook/basic-types.html), [Flow](https://flow.org/en/docs/types/), [Go](https://gobyexample.com/structs), and [GraphQL](http://graphql.org/learn/schema/), giving it a familiar and easy to understand API.
But Superstruct is designed for validating data at runtime, so it throws (or returns) detailed runtime errors for you or your end users. This is especially useful in situations like accepting arbitrary input in a REST or GraphQL API. But it can even be used to validate internal data structures at runtime when needed.
<br/>
### Usage
Superstruct allows you to define the shape of data you want to validate:
```js
import { assert, object, number, string, array } from 'superstruct'
const Article = object({
id: number(),
title: string(),
tags: array(string()),
author: object({
id: number(),
}),
})
const data = {
id: 34,
title: 'Hello World',
tags: ['news', 'features'],
author: {
id: 1,
},
}
assert(data, Article)
// This will throw an error when the data is invalid.
// If you'd rather not throw, you can use `is()` or `validate()`.
```
Superstruct ships with validators for all the common JavaScript data types, and you can define custom ones too:
```js
import { is, define, object, string } from 'superstruct'
import isUuid from 'is-uuid'
import isEmail from 'is-email'
const Email = define('Email', isEmail)
const Uuid = define('Uuid', isUuid.v4)
const User = object({
id: Uuid,
email: Email,
name: string(),
})
const data = {
id: 'c8d63140-a1f7-45e0-bfc6-df72973fea86',
email: 'jane@example.com',
name: 'Jane',
}
if (is(data, User)) {
// Your data is guaranteed to be valid in this block.
}
```
Superstruct can also handle coercion of your data before validating it, for example to mix in default values:
```ts
import { create, object, number, string, defaulted } from 'superstruct'
let i = 0
const User = object({
id: defaulted(number(), () => i++),
name: string(),
})
const data = {
name: 'Jane',
}
// You can apply the defaults to your data while validating.
const user = create(data, User)
// {
// id: 0,
// name: 'Jane',
// }
```
And if you use TypeScript, Superstruct automatically ensures that your data has proper typings whenever you validate it:
```ts
import { is, object, number, string } from 'superstruct'
const User = object({
id: number(),
name: string()
})
const data: unknown = { ... }
if (is(data, User)) {
// TypeScript knows the shape of `data` here, so it is safe to access
// properties like `data.id` and `data.name`.
}
```
Superstruct supports more complex use cases too like defining arrays or nested objects, composing structs inside each other, returning errors instead of throwing them, and more! For more information read the full [Documentation](#documentation).
<br/>
### Why?
There are lots of existing validation libraries—[`joi`](https://github.com/hapijs/joi), [`express-validator`](https://github.com/ctavan/express-validator), [`validator.js`](https://github.com/chriso/validator.js), [`yup`](https://github.com/jquense/yup), [`ajv`](https://github.com/epoberezkin/ajv), [`is-my-json-valid`](https://github.com/mafintosh/is-my-json-valid)... But they exhibit many issues that lead to your codebase becoming hard to maintain...
- **They don't expose detailed errors.** Many validators simply return string-only errors or booleans without any details as to why, making it difficult to customize the errors to be helpful for end-users.
- **They make custom types hard.** Many validators ship with built-in types like emails, URLs, UUIDs, etc. with no way to know what they check for, and complicated APIs for defining new types.
- **They don't encourage single sources of truth.** Many existing APIs encourage re-defining custom data types over and over, with the source of truth being spread out across your entire code base.
- **They don't throw errors.** Many don't actually throw the errors, forcing you to wrap everywhere. Although helpful in the days of callbacks, not using `throw` in modern JavaScript makes code much more complex.
- **They're tightly coupled to other concerns.** Many validators are tightly coupled to Express or other frameworks, which results in one-off, confusing code that isn't reusable across your code base.
- **They use JSON Schema.** Don't get me wrong, JSON Schema _can_ be useful. But it's kind of like HATEOAS—it's usually way more complexity than you need and you aren't using any of its benefits. (Sorry, I said it.)
Of course, not every validation library suffers from all of these issues, but most of them exhibit at least one. If you've run into this problem before, you might like Superstruct.
Which brings me to how Superstruct solves these issues...
<br/>
### Principles
1. **Customizable types.** Superstruct's power is in making it easy to define an entire set of custom data types that are specific to your application, and defined in a _single_ place, so you have full control over your requirements.
2. **Unopinionated defaults.** Superstruct ships with native JavaScript types, and everything else is customizable, so you never have to fight to override decisions made by "core" that differ from your application's needs.
3. **Composable interfaces.** Superstruct interfaces are composable, so you can break down commonly-repeated pieces of data into components, and compose them to build up the more complex objects.
4. **Useful errors.** The errors that Superstruct throws contain all the information you need to convert them into your own application-specific errors easy, which means more helpful errors for your end users!
5. **Familiar API.** The Superstruct API was heavily inspired by [Typescript](https://www.typescriptlang.org/docs/handbook/basic-types.html), [Flow](https://flow.org/en/docs/types/), [Go](https://gobyexample.com/structs), and [GraphQL](http://graphql.org/learn/schema/). If you're familiar with any of those, then its schema definition API will feel very natural to use, so you can get started quickly.
<br/>
### Demo
Try out the [live demo on CodeSandbox](https://codesandbox.io/s/bold-water-s2cr8d?file=/index.js) to get an idea for how the API works, or to quickly verify your use case:
[![Demo screenshot.](./docs/images/demo-screenshot.png)](https://codesandbox.io/s/bold-water-s2cr8d?file=/index.js)
<br/>
### Examples
Superstruct's API is very flexible, allowing it to be used for a variety of use cases on your servers and in the browser. Here are a few examples of common patterns...
- [Basic Validation](./examples/basic-validation.js)
- [Custom Types](./examples/custom-types.js)
- [Default Values](./examples/default-values.js)
- [Optional Values](./examples/optional-values.js)
- [Composing Structs](./examples/composing-structs.js)
- [Throwing Errors](./examples/throwing-errors.js)
- [Returning Errors](./examples/returning-errors.js)
- [Testing Values](./examples/testing-values.js)
- [Custom Errors](./examples/custom-errors.js)
<br/>
### Documentation
Read the getting started guide to familiarize yourself with how Superstruct works. After that, check out the full API reference for more detailed information about structs, types and errors...
- [**Guide**](https://docs.superstructjs.org/guides/01-getting-started)
- [Getting Started](https://docs.superstructjs.org/guides/01-getting-started)
- [Validating Data](https://docs.superstructjs.org/guides/02-validating-data)
- [Coercing Data](https://docs.superstructjs.org/guides/03-coercing-data)
- [Refining Validation](https://docs.superstructjs.org/guides/04-refining-validation)
- [Handling Errors](https://docs.superstructjs.org/guides/05-handling-errors)
- [Using TypeScript](https://docs.superstructjs.org/guides/06-using-typescript)
- [**Reference**](https://docs.superstructjs.org/api-reference/core)
- [Core](https://docs.superstructjs.org/api-reference/core)
- [Types](https://docs.superstructjs.org/api-reference/types)
- [Refinements](https://docs.superstructjs.org/api-reference/refinements)
- [Coercions](https://docs.superstructjs.org/api-reference/coercions)
- [Utilities](https://docs.superstructjs.org/api-reference/utilities)
- [Errors](https://docs.superstructjs.org/api-reference/errors)
- [TypeScript](https://docs.superstructjs.org/api-reference/typescript)
- [**FAQ**](https://docs.superstructjs.org/resources/faq)
- [**Resources**](https://docs.superstructjs.org/resources/links)
[![Docs screenshot.](./docs/images/docs-screenshot.png)](https://docs.superstructjs.org)
<br/>
### License
This package is [MIT-licensed](./License.md).

33
node_modules/superstruct/dist/error.d.ts generated vendored Normal file
View File

@@ -0,0 +1,33 @@
/**
* A `StructFailure` represents a single specific failure in validation.
*/
export type Failure = {
value: any;
key: any;
type: string;
refinement: string | undefined;
message: string;
explanation?: string;
branch: Array<any>;
path: Array<any>;
};
/**
* `StructError` objects are thrown (or returned) when validation fails.
*
* Validation logic is design to exit early for maximum performance. The error
* represents the first error encountered during validation. For more detail,
* the `error.failures` property is a generator function that can be run to
* continue validation and receive all the failures in the data.
*/
export declare class StructError extends TypeError {
value: any;
key: any;
type: string;
refinement: string | undefined;
path: Array<any>;
branch: Array<any>;
failures: () => Array<Failure>;
[x: string]: any;
constructor(failure: Failure, failures: () => Generator<Failure>);
}
//# sourceMappingURL=error.d.ts.map

1
node_modules/superstruct/dist/error.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,GAAG,CAAA;IACV,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAClB,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CACjB,CAAA;AAED;;;;;;;GAOG;AAEH,qBAAa,WAAY,SAAQ,SAAS;IACxC,KAAK,EAAE,GAAG,CAAA;IACV,GAAG,EAAG,GAAG,CAAA;IACT,IAAI,EAAG,MAAM,CAAA;IACb,UAAU,EAAG,MAAM,GAAG,SAAS,CAAA;IAC/B,IAAI,EAAG,KAAK,CAAC,GAAG,CAAC,CAAA;IACjB,MAAM,EAAG,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,QAAQ,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;gBAEJ,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC,OAAO,CAAC;CAcjE"}

1084
node_modules/superstruct/dist/index.cjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/superstruct/dist/index.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

7
node_modules/superstruct/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export * from './error.js';
export * from './struct.js';
export * from './structs/coercions.js';
export * from './structs/refinements.js';
export * from './structs/types.js';
export * from './structs/utilities.js';
//# sourceMappingURL=index.d.ts.map

1
node_modules/superstruct/dist/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA"}

1026
node_modules/superstruct/dist/index.mjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/superstruct/dist/index.mjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

119
node_modules/superstruct/dist/struct.d.ts generated vendored Normal file
View File

@@ -0,0 +1,119 @@
import { StructSchema } from './utils.js';
import { StructError, Failure } from './error.js';
/**
* `Struct` objects encapsulate the validation logic for a specific type of
* values. Once constructed, you use the `assert`, `is` or `validate` helpers to
* validate unknown input data against the struct.
*/
export declare class Struct<T = unknown, S = unknown> {
readonly TYPE: T;
type: string;
schema: S;
coercer: (value: unknown, context: Context) => unknown;
validator: (value: unknown, context: Context) => Iterable<Failure>;
refiner: (value: T, context: Context) => Iterable<Failure>;
entries: (value: unknown, context: Context) => Iterable<[string | number, unknown, Struct<any> | Struct<never>]>;
constructor(props: {
type: string;
schema: S;
coercer?: Coercer;
validator?: Validator;
refiner?: Refiner<T>;
entries?: Struct<T, S>['entries'];
});
/**
* Assert that a value passes the struct's validation, throwing if it doesn't.
*/
assert(value: unknown, message?: string): asserts value is T;
/**
* Create a value with the struct's coercion logic, then validate it.
*/
create(value: unknown, message?: string): T;
/**
* Check if a value passes the struct's validation.
*/
is(value: unknown): value is T;
/**
* Mask a value, coercing and validating it, but returning only the subset of
* properties defined by the struct's schema. Masking applies recursively to
* props of `object` structs only.
*/
mask(value: unknown, message?: string): T;
/**
* Validate a value with the struct's validation logic, returning a tuple
* representing the result.
*
* You may optionally pass `true` for the `coerce` argument to coerce
* the value before attempting to validate it. If you do, the result will
* contain the coerced result when successful. Also, `mask` will turn on
* masking of the unknown `object` props recursively if passed.
*/
validate(value: unknown, options?: {
coerce?: boolean;
mask?: boolean;
message?: string;
}): [StructError, undefined] | [undefined, T];
}
/**
* Assert that a value passes a struct, throwing if it doesn't.
*/
export declare function assert<T, S>(value: unknown, struct: Struct<T, S>, message?: string): asserts value is T;
/**
* Create a value with the coercion logic of struct and validate it.
*/
export declare function create<T, S>(value: unknown, struct: Struct<T, S>, message?: string): T;
/**
* Mask a value, returning only the subset of properties defined by a struct.
*/
export declare function mask<T, S>(value: unknown, struct: Struct<T, S>, message?: string): T;
/**
* Check if a value passes a struct.
*/
export declare function is<T, S>(value: unknown, struct: Struct<T, S>): value is T;
/**
* Validate a value against a struct, returning an error if invalid, or the
* value (with potential coercion) if valid.
*/
export declare function validate<T, S>(value: unknown, struct: Struct<T, S>, options?: {
coerce?: boolean;
mask?: boolean;
message?: string;
}): [StructError, undefined] | [undefined, T];
/**
* A `Context` contains information about the current location of the
* validation inside the initial input value. It also carries `mask`
* since it's a run-time flag determining how the validation was invoked
* (via `mask()` or via `validate()`), plus it applies recursively
* to all of the nested structs.
*/
export type Context = {
branch: Array<any>;
path: Array<any>;
mask?: boolean;
};
/**
* A type utility to extract the type from a `Struct` class.
*/
export type Infer<T extends Struct<any, any>> = T['TYPE'];
/**
* A type utility to describe that a struct represents a TypeScript type.
*/
export type Describe<T> = Struct<T, StructSchema<T>>;
/**
* A `Result` is returned from validation functions.
*/
export type Result = boolean | string | Partial<Failure> | Iterable<boolean | string | Partial<Failure>>;
/**
* A `Coercer` takes an unknown value and optionally coerces it.
*/
export type Coercer<T = unknown> = (value: T, context: Context) => unknown;
/**
* A `Validator` takes an unknown value and validates it.
*/
export type Validator = (value: unknown, context: Context) => Result;
/**
* A `Refiner` takes a value of a known type and validates it against a further
* constraint.
*/
export type Refiner<T> = (value: T, context: Context) => Result;
//# sourceMappingURL=struct.d.ts.map

1
node_modules/superstruct/dist/struct.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../src/struct.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,YAAY,EAAO,MAAM,YAAY,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEjD;;;;GAIG;AAEH,qBAAa,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IAC1C,QAAQ,CAAC,IAAI,EAAG,CAAC,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,CAAC,CAAA;IACT,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAA;I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AAG;IACpB,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAClB,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;GAEG;AAEH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzD;;GAEG;AAEH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpD;;GAEG;AAEH,MAAM,MAAM,MAAM,GACd,OAAO,GACP,MAAM,GACN,OAAO,CAAC,OAAO,CAAC,GAChB,QAAQ,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;AAEjD;;GAEG;AAEH,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAA;AAE1E;;GAEG;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA;AAEpE;;;GAGG;AAEH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA"}

29
node_modules/superstruct/dist/structs/coercions.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import { Struct, Coercer } from '../struct.js';
/**
* Augment a `Struct` to add an additional coercion step to its input.
*
* This allows you to transform input data before validating it, to increase the
* likelihood that it passes validation—for example for default values, parsing
* different formats, etc.
*
* Note: You must use `create(value, Struct)` on the value to have the coercion
* take effect! Using simply `assert()` or `is()` will not use coercion.
*/
export declare function coerce<T, S, C>(struct: Struct<T, S>, condition: Struct<C, any>, coercer: Coercer<C>): Struct<T, S>;
/**
* Augment a struct to replace `undefined` values with a default.
*
* Note: You must use `create(value, Struct)` on the value to have the coercion
* take effect! Using simply `assert()` or `is()` will not use coercion.
*/
export declare function defaulted<T, S>(struct: Struct<T, S>, fallback: any, options?: {
strict?: boolean;
}): Struct<T, S>;
/**
* Augment a struct to trim string inputs.
*
* Note: You must use `create(value, Struct)` on the value to have the coercion
* take effect! Using simply `assert()` or `is()` will not use coercion.
*/
export declare function trimmed<T, S>(struct: Struct<T, S>): Struct<T, S>;
//# sourceMappingURL=coercions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"coercions.d.ts","sourceRoot":"","sources":["../../src/structs/coercions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAM,OAAO,EAAE,MAAM,cAAc,CAAA;AAIlD;;;;;;;;;GASG;AAEH,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC5B,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,SAAS,EAAE,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,EACzB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAClB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CASd;AAED;;;;;GAKG;AAEH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAC5B,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,QAAQ,EAAE,GAAG,EACb,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,OAAO,CAAA;CACZ,GACL,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CA0Bd;AAED;;;;;GAKG;AAEH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAEhE"}

38
node_modules/superstruct/dist/structs/refinements.d.ts generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import { Struct, Refiner } from '../struct.js';
/**
* Ensure that a string, array, map, or set is empty.
*/
export declare function empty<T extends string | any[] | Map<any, any> | Set<any>, S extends any>(struct: Struct<T, S>): Struct<T, S>;
/**
* Ensure that a number or date is below a threshold.
*/
export declare function max<T extends number | Date, S extends any>(struct: Struct<T, S>, threshold: T, options?: {
exclusive?: boolean;
}): Struct<T, S>;
/**
* Ensure that a number or date is above a threshold.
*/
export declare function min<T extends number | Date, S extends any>(struct: Struct<T, S>, threshold: T, options?: {
exclusive?: boolean;
}): Struct<T, S>;
/**
* Ensure that a string, array, map or set is not empty.
*/
export declare function nonempty<T extends string | any[] | Map<any, any> | Set<any>, S extends any>(struct: Struct<T, S>): Struct<T, S>;
/**
* Ensure that a string matches a regular expression.
*/
export declare function pattern<T extends string, S extends any>(struct: Struct<T, S>, regexp: RegExp): Struct<T, S>;
/**
* Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`.
*/
export declare function size<T extends string | number | Date | any[] | Map<any, any> | Set<any>, S extends any>(struct: Struct<T, S>, min: number, max?: number): Struct<T, S>;
/**
* Augment a `Struct` to add an additional refinement to the validation.
*
* The refiner function is guaranteed to receive a value of the struct's type,
* because the struct's existing validation will already have passed. This
* allows you to layer additional validation on top of existing structs.
*/
export declare function refine<T, S>(struct: Struct<T, S>, name: string, refiner: Refiner<T>): Struct<T, S>;
//# sourceMappingURL=refinements.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"refinements.d.ts","sourceRoot":"","sources":["../../src/structs/refinements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG9C;;GAEG;AAEH,wBAAgB,KAAK,CACnB,CAAC,SAAS,MAAM,GAAG,GAAG,EAAE,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,EACnD,CAAC,SAAS,G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EAAE,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,EACnE,CAAC,SAAS,GAAG,EACb,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAY,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAwBpE;AAED;;;;;;GAMG;AAEH,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EACzB,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAClB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAad"}

142
node_modules/superstruct/dist/structs/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,142 @@
import { Infer, Struct } from '../struct.js';
import { ObjectSchema, ObjectType, AnyStruct, InferStructTuple, UnionToIntersection } from '../utils.js';
/**
* Ensure that any value passes validation.
*/
export declare function any(): Struct<any, null>;
/**
* Ensure that a value is an array and that its elements are of a specific type.
*
* Note: If you omit the element struct, the arrays elements will not be
* iterated at all. This can be helpful for cases where performance is critical,
* and it is preferred to using `array(any())`.
*/
export declare function array<T extends Struct<any>>(Element: T): Struct<Infer<T>[], T>;
export declare function array(): Struct<unknown[], undefined>;
/**
* Ensure that a value is a bigint.
*/
export declare function bigint(): Struct<bigint, null>;
/**
* Ensure that a value is a boolean.
*/
export declare function boolean(): Struct<boolean, null>;
/**
* Ensure that a value is a valid `Date`.
*
* Note: this also ensures that the value is *not* an invalid `Date` object,
* which can occur when parsing a date fails but still returns a `Date`.
*/
export declare function date(): Struct<Date, null>;
/**
* Ensure that a value is one of a set of potential values.
*
* Note: after creating the struct, you can access the definition of the
* potential values as `struct.schema`.
*/
export declare function enums<U extends number, T extends readonly U[]>(values: T): Struct<T[number], {
[K in T[number]]: K;
}>;
export declare function enums<U extends string, T extends readonly U[]>(values: T): Struct<T[number], {
[K in T[number]]: K;
}>;
/**
* Ensure that a value is a function.
*/
export declare function func(): Struct<Function, null>;
/**
* Ensure that a value is an instance of a specific class.
*/
export declare function instance<T extends {
new (...args: any): any;
}>(Class: T): Struct<InstanceType<T>, null>;
/**
* Ensure that a value is an integer.
*/
export declare function integer(): Struct<number, null>;
/**
* Ensure that a value matches all of a set of types.
*/
export declare function intersection<A extends AnyStruct, B extends AnyStruct[]>(Structs: [A, ...B]): Struct<Infer<A> & UnionToIntersection<InferStructTuple<B>[number]>, null>;
/**
* Ensure that a value is an exact value, using `===` for comparison.
*/
export declare function literal<T extends boolean>(constant: T): Struct<T, T>;
export declare function literal<T extends number>(constant: T): Struct<T, T>;
export declare function literal<T extends string>(constant: T): Struct<T, T>;
export declare function literal<T>(constant: T): Struct<T, null>;
/**
* Ensure that a value is a `Map` object, and that its keys and values are of
* specific types.
*/
export declare function map(): Struct<Map<unknown, unknown>, null>;
export declare function map<K, V>(Key: Struct<K>, Value: Struct<V>): Struct<Map<K, V>, null>;
/**
* Ensure that no value ever passes validation.
*/
export declare function never(): Struct<never, null>;
/**
* Augment an existing struct to allow `null` values.
*/
export declare function nullable<T, S>(struct: Struct<T, S>): Struct<T | null, S>;
/**
* Ensure that a value is a number.
*/
export declare function number(): Struct<number, null>;
/**
* Ensure that a value is an object, that is has a known set of properties,
* and that its properties are of specific types.
*
* Note: Unrecognized properties will fail validation.
*/
export declare function object(): Struct<Record<string, unknown>, null>;
export declare function object<S extends ObjectSchema>(schema: S): Struct<ObjectType<S>, S>;
/**
* Augment a struct to allow `undefined` values.
*/
export declare function optional<T, S>(struct: Struct<T, S>): Struct<T | undefined, S>;
/**
* Ensure that a value is an object with keys and values of specific types, but
* without ensuring any specific shape of properties.
*
* Like TypeScript's `Record` utility.
*/
export declare function record<K extends string, V>(Key: Struct<K>, Value: Struct<V>): Struct<Record<K, V>, null>;
/**
* Ensure that a value is a `RegExp`.
*
* Note: this does not test the value against the regular expression! For that
* you need to use the `pattern()` refinement.
*/
export declare function regexp(): Struct<RegExp, null>;
/**
* Ensure that a value is a `Set` object, and that its elements are of a
* specific type.
*/
export declare function set(): Struct<Set<unknown>, null>;
export declare function set<T>(Element: Struct<T>): Struct<Set<T>, null>;
/**
* Ensure that a value is a string.
*/
export declare function string(): Struct<string, null>;
/**
* Ensure that a value is a tuple of a specific length, and that each of its
* elements is of a specific type.
*/
export declare function tuple<A extends AnyStruct, B extends AnyStruct[]>(Structs: [A, ...B]): Struct<[Infer<A>, ...InferStructTuple<B>], null>;
/**
* Ensure that a value has a set of known properties of specific types.
*
* Note: Unrecognized properties are allowed and untouched. This is similar to
* how TypeScript's structural typing works.
*/
export declare function type<S extends ObjectSchema>(schema: S): Struct<ObjectType<S>, S>;
/**
* Ensure that a value matches one of a set of types.
*/
export declare function union<A extends AnyStruct, B extends AnyStruct[]>(Structs: [A, ...B]): Struct<Infer<A> | InferStructTuple<B>[number], null>;
/**
* Ensure that any value passes validation, without widening its type to `any`.
*/
export declare function unknown(): Struct<unknown, null>;
//# sourceMappingURL=types.d.ts.map

1
node_modules/superstruct/dist/structs/types.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/structs/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,EACL,YAAY,EACZ,UAAU,EAKV,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,aAAa,CAAA;AAEpB;;GAEG;AAEH,wBAAgB,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAEvC;AAED;;;;;;GAMG;AAEH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC/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AAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAAE,EAC9D,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GACjB,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAyBlD;AAED;;;;;GAKG;AAEH,wBAAgB,IAAI,CAAC,CAAC,SAAS,YAAY,EACzC,MAAM,EAAE,CAAC,GACR,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAsB1B;AAED;;GAEG;AAEH,wBAAgB,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAAE,EAC9D,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GACjB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CA4CtD;AAED;;GAEG;AAEH,wBAAgB,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAE/C"}

66
node_modules/superstruct/dist/structs/utilities.d.ts generated vendored Normal file
View File

@@ -0,0 +1,66 @@
import { Context, Struct, Validator } from '../struct.js';
import { Assign, ObjectSchema, ObjectType, PartialObjectSchema } from '../utils.js';
/**
* Create a new struct that combines the properties properties from multiple
* object or type structs. Its return type will match the first parameter's type.
*
* Like JavaScript's `Object.assign` utility.
*/
export declare function assign<A extends ObjectSchema, B extends ObjectSchema>(A: Struct<ObjectType<A>, A>, B: Struct<ObjectType<B>, B>): Struct<ObjectType<Assign<A, B>>, Assign<A, B>>;
export declare function assign<A extends ObjectSchema, B extends ObjectSchema, C extends ObjectSchema>(A: Struct<ObjectType<A>, A>, B: Struct<ObjectType<B>, B>, C: Struct<ObjectType<C>, C>): Struct<ObjectType<Assign<Assign<A, B>, C>>, Assign<Assign<A, B>, C>>;
export declare function assign<A extends ObjectSchema, B extends ObjectSchema, C extends ObjectSchema, D extends ObjectSchema>(A: Struct<ObjectType<A>, A>, B: Struct<ObjectType<B>, B>, C: Struct<ObjectType<C>, C>, D: Struct<ObjectType<D>, D>): Struct<ObjectType<Assign<Assign<Assign<A, B>, C>, D>>, Assign<Assign<Assign<A, B>, C>, D>>;
export declare function assign<A extends ObjectSchema, B extends ObjectSchema, C extends ObjectSchema, D extends ObjectSchema, E extends ObjectSchema>(A: Struct<ObjectType<A>, A>, B: Struct<ObjectType<B>, B>, C: Struct<ObjectType<C>, C>, D: Struct<ObjectType<D>, D>, E: Struct<ObjectType<E>, E>): Struct<ObjectType<Assign<Assign<Assign<Assign<A, B>, C>, D>, E>>, Assign<Assign<Assign<Assign<A, B>, C>, D>, E>>;
/**
* Define a new struct type with a custom validation function.
*/
export declare function define<T>(name: string, validator: Validator): Struct<T, null>;
/**
* Create a new struct based on an existing struct, but the value is allowed to
* be `undefined`. `log` will be called if the value is not `undefined`.
*/
export declare function deprecated<T>(struct: Struct<T>, log: (value: unknown, ctx: Context) => void): Struct<T>;
/**
* Create a struct with dynamic validation logic.
*
* The callback will receive the value currently being validated, and must
* return a struct object to validate it with. This can be useful to model
* validation logic that changes based on its input.
*/
export declare function dynamic<T>(fn: (value: unknown, ctx: Context) => Struct<T, any>): Struct<T, null>;
/**
* Create a struct with lazily evaluated validation logic.
*
* The first time validation is run with the struct, the callback will be called
* and must return a struct object to use. This is useful for cases where you
* want to have self-referential structs for nested data structures to avoid a
* circular definition problem.
*/
export declare function lazy<T>(fn: () => Struct<T, any>): Struct<T, null>;
/**
* Create a new struct based on an existing object struct, but excluding
* specific properties.
*
* Like TypeScript's `Omit` utility.
*/
export declare function omit<S extends ObjectSchema, K extends keyof S>(struct: Struct<ObjectType<S>, S>, keys: K[]): Struct<ObjectType<Omit<S, K>>, Omit<S, K>>;
/**
* Create a new struct based on an existing object struct, but with all of its
* properties allowed to be `undefined`.
*
* Like TypeScript's `Partial` utility.
*/
export declare function partial<S extends ObjectSchema>(struct: Struct<ObjectType<S>, S> | S): Struct<ObjectType<PartialObjectSchema<S>>, PartialObjectSchema<S>>;
/**
* Create a new struct based on an existing object struct, but only including
* specific properties.
*
* Like TypeScript's `Pick` utility.
*/
export declare function pick<S extends ObjectSchema, K extends keyof S>(struct: Struct<ObjectType<S>, S>, keys: K[]): Struct<ObjectType<Pick<S, K>>, Pick<S, K>>;
/**
* Define a new struct type with a custom validation function.
*
* @deprecated This function has been renamed to `define`.
*/
export declare function struct<T>(name: string, validator: Validator): Struct<T, null>;
//# sourceMappingURL=utilities.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../src/structs/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,mBAAmB,EACpB,MAAM,aAAa,CAAA;AAGpB;;;;;GAKG;AAEH,wBAAgB,MAAM,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,YAAY,EACnE,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC3B,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACjD,wBAAgB,MAAM,CACpB,CAAC,SAAS,YAAY,EACtB,CAAC,SAAS,YAAY,EACtB,CAAC,SAAS,YAAY,EAEtB,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC3B,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC3B,CAAC,EA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,IAAI,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM,CAAC,EAC5D,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAChC,IAAI,EAAE,CAAC,EAAE,GACR,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAc5C;AAED;;;;;GAKG;AAEH,wBAAgB,OAAO,CAAC,CAAC,SAAS,YAAY,EAC5C,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GACnC,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAapE;AAED;;;;;GAKG;AAEH,wBAAgB,IAAI,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM,CAAC,EAC5D,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAChC,IAAI,EAAE,CAAC,EAAE,GACR,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAe5C;AAED;;;;GAIG;AAEH,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAM7E"}

144
node_modules/superstruct/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,144 @@
import { Struct, Infer, Result, Context, Describe } from './struct.js';
import { Failure } from './error.js';
/**
* Check if a value is a plain object.
*/
export declare function isObject(x: unknown): x is object;
/**
* Check if a value is a non-array object.
*/
export declare function isNonArrayObject(x: unknown): x is object;
/**
* Check if a value is a plain object.
*/
export declare function isPlainObject(x: unknown): x is {
[key: string]: any;
};
/**
* Return a value as a printable string.
*/
export declare function print(value: any): string;
/**
* Shifts (removes and returns) the first value from the `input` iterator.
* Like `Array.prototype.shift()` but for an `Iterator`.
*/
export declare function shiftIterator<T>(input: Iterator<T>): T | undefined;
/**
* Convert a single validation result to a failure.
*/
export declare function toFailure<T, S>(result: string | boolean | Partial<Failure>, context: Context, struct: Struct<T, S>, value: any): Failure | undefined;
/**
* Convert a validation result to an iterable of failures.
*/
export declare function toFailures<T, S>(result: Result, context: Context, struct: Struct<T, S>, value: any): IterableIterator<Failure>;
/**
* Check a value against a struct, traversing deeply into nested values, and
* returning an iterator of failures or success.
*/
export declare function run<T, S>(value: unknown, struct: Struct<T, S>, options?: {
path?: any[];
branch?: any[];
coerce?: boolean;
mask?: boolean;
message?: string;
}): IterableIterator<[Failure, undefined] | [undefined, T]>;
/**
* Convert a union of type to an intersection.
*/
export type UnionToIntersection<U> = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void ? I : never;
/**
* Assign properties from one type to another, overwriting existing.
*/
export type Assign<T, U> = Simplify<U & Omit<T, keyof U>>;
/**
* A schema for enum structs.
*/
export type EnumSchema<T extends string | number | undefined | null> = {
[K in NonNullable<T>]: K;
};
/**
* Check if a type is a match for another whilst treating overlapping
* unions as a match.
*/
export type IsMatch<T, G> = T extends G ? (G extends T ? T : never) : never;
/**
* Check if a type is an exact match.
*/
export type IsExactMatch<T, U> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? T : never;
/**
* Check if a type is a record type.
*/
export type IsRecord<T> = T extends object ? string extends keyof T ? T : never : never;
/**
* Check if a type is a tuple.
*/
export type IsTuple<T> = T extends [any] ? T : T extends [any, any] ? T : T extends [any, any, any] ? T : T extends [any, any, any, any] ? T : T extends [any, any, any, any, any] ? T : never;
/**
* Check if a type is a union.
*/
export type IsUnion<T, U extends T = T> = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T;
/**
* A schema for object structs.
*/
export type ObjectSchema = Record<string, Struct<any, any>>;
/**
* Infer a type from an object struct schema.
*/
export type ObjectType<S extends ObjectSchema> = Simplify<Optionalize<{
[K in keyof S]: Infer<S[K]>;
}>>;
/**
* Omit properties from a type that extend from a specific type.
*/
export type OmitBy<T, V> = Omit<T, {
[K in keyof T]: V extends Extract<T[K], V> ? K : never;
}[keyof T]>;
/**
* Normalize properties of a type that allow `undefined` to make them optional.
*/
export type Optionalize<S extends object> = OmitBy<S, undefined> & Partial<PickBy<S, undefined>>;
/**
* Transform an object schema type to represent a partial.
*/
export type PartialObjectSchema<S extends ObjectSchema> = {
[K in keyof S]: Struct<Infer<S[K]> | undefined>;
};
/**
* Pick properties from a type that extend from a specific type.
*/
export type PickBy<T, V> = Pick<T, {
[K in keyof T]: V extends Extract<T[K], V> ? K : never;
}[keyof T]>;
/**
* Simplifies a type definition to its most basic representation.
*/
export type Simplify<T> = T extends any[] | Date ? T : {
[K in keyof T]: T[K];
} & {};
export type If<B extends Boolean, Then, Else> = B extends true ? Then : Else;
/**
* A schema for any type of struct.
*/
export type StructSchema<T> = [T] extends [string | undefined | null] ? [T] extends [IsMatch<T, string | undefined | null>] ? null : [T] extends [IsUnion<T>] ? EnumSchema<T> : T : [T] extends [number | undefined | null] ? [T] extends [IsMatch<T, number | undefined | null>] ? null : [T] extends [IsUnion<T>] ? EnumSchema<T> : T : [T] extends [boolean] ? [T] extends [IsExactMatch<T, boolean>] ? null : T : T extends bigint | symbol | undefined | null | Function | Date | Error | RegExp | Map<any, any> | WeakMap<any, any> | Set<any> | WeakSet<any> | Promise<any> ? null : T extends Array<infer E> ? T extends IsTuple<T> ? null : Struct<E> : T extends object ? T extends IsRecord<T> ? null : {
[K in keyof T]: Describe<T[K]>;
} : null;
/**
* A schema for tuple structs.
*/
export type TupleSchema<T> = {
[K in keyof T]: Struct<T[K]>;
};
/**
* Shorthand type for matching any `Struct`.
*/
export type AnyStruct = Struct<any, any>;
/**
* Infer a tuple of types from a tuple of `Struct`s.
*
* This is used to recursively retrieve the type from `union` `intersection` and
* `tuple` structs.
*/
export type InferStructTuple<Tuple extends AnyStruct[], Length extends number = Tuple['length']> = Length extends Length ? number extends Length ? Tuple : _InferTuple<Tuple, Length, []> : never;
type _InferTuple<Tuple extends AnyStruct[], Length extends number, Accumulated extends unknown[], Index extends number = Accumulated['length']> = Index extends Length ? Accumulated : _InferTuple<Tuple, Length, [...Accumulated, Infer<Tuple[Index]>]>;
export {};
//# sourceMappingURL=utils.d.ts.map

1
node_modules/superstruct/dist/utils.d.ts.map generated vendored Normal file

File diff suppressed because one or more lines are too long

85
node_modules/superstruct/package.json generated vendored Normal file
View File

@@ -0,0 +1,85 @@
{
"name": "superstruct",
"description": "A simple and composable way to validate data in JavaScript (and TypeScript).",
"version": "2.0.2",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/superstruct.git",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"engines": {
"node": ">=14.0.0"
},
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.6",
"@types/expect": "^24.3.0",
"@types/lodash": "^4.14.144",
"@types/node": "^18.7.14",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"lodash": "^4.17.15",
"np": "^10.0.0",
"prettier": "^3.2.5",
"rollup": "^4.12.1",
"typescript": "^4.8.3",
"vitest": "^1.6.0"
},
"scripts": {
"build": "rm -rf ./{dist} && rollup --config ./rollup.config.js",
"clean": "rm -rf ./{dist,node_modules}",
"fix": "npm run fix:eslint && npm run fix:prettier",
"fix:eslint": "npm run lint:eslint --fix",
"fix:prettier": "prettier '**/*.{js,json,ts}' --write",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint '{src,test}/*.{js,ts}'",
"lint:prettier": "prettier '**/*.{js,json,ts}' --check",
"release": "npm run build && npm run lint && np",
"test": "npm run build && npm run test:types && npm run test:vitest",
"test:types": "tsc --noEmit && tsc --project ./test/tsconfig.json --noEmit",
"test:vitest": "vitest run",
"test:watch": "vitest",
"watch": "npm run build -- --watch"
},
"keywords": [
"api",
"array",
"assert",
"cast",
"check",
"checker",
"collection",
"data",
"error",
"express",
"hapi",
"interface",
"invalid",
"joi",
"json",
"list",
"model",
"object",
"orm",
"scalar",
"schema",
"struct",
"throw",
"type",
"types",
"valid",
"validate",
"validation",
"validator"
]
}