feat: Reinitialize frontend with SvelteKit and TypeScript

- Delete old Vite+Svelte frontend
- Initialize new SvelteKit project with TypeScript
- Configure Tailwind CSS v4 + DaisyUI
- Implement JWT authentication with auto-refresh
- Create login page with form validation (Zod)
- Add protected route guards
- Update Docker configuration for single-stage build
- Add E2E tests with Playwright (6/11 passing)
- Fix Svelte 5 reactivity with $state() runes

Known issues:
- 5 E2E tests failing (timing/async issues)
- Token refresh implementation needs debugging
- Validation error display timing
This commit is contained in:
2026-02-17 16:19:59 -05:00
parent 54df6018f5
commit de2d83092e
28274 changed files with 3816354 additions and 90 deletions

3
frontend/node_modules/ts-algebra/.eslintignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
lib
builds
coverage

153
frontend/node_modules/ts-algebra/.eslintrc.js generated vendored Normal file
View File

@@ -0,0 +1,153 @@
module.exports = {
plugins: ["prefer-arrow", "import", "prettier", "unused-imports", "jsdoc"],
extends: [
"eslint:recommended",
"plugin:import/recommended",
"plugin:prettier/recommended",
"prettier",
"plugin:jsdoc/recommended",
],
rules: {
"jsdoc/require-jsdoc": [
"error",
{
contexts: [
"TSTypeAliasDeclaration",
"TSInterfaceDeclaration",
"TSMethodSignature",
// "TSPropertySignature",
"TSDeclareFunction",
"TSEnumDeclaration",
],
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: true,
},
},
],
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off",
"prettier/prettier": "error",
"import/extensions": "off",
"import/no-unresolved": ["error", { caseSensitiveStrict: true }],
"import/prefer-default-export": "off",
"import/no-duplicates": "error",
complexity: ["error", 8],
"max-lines": ["error", 200],
"max-depth": ["error", 3],
"max-params": ["error", 4],
eqeqeq: ["error", "smart"],
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: true,
optionalDependencies: false,
peerDependencies: false,
},
],
"no-shadow": ["error", { hoist: "all" }],
"prefer-const": "error",
"padding-line-between-statements": [
"error",
{
blankLine: "always",
prev: "*",
next: "return",
},
],
"prefer-arrow/prefer-arrow-functions": [
"error",
{
disallowPrototype: true,
singleReturnOnly: false,
classPropertiesAllowed: false,
},
],
"no-restricted-imports": [
"error",
{
paths: [
{
name: "lodash",
message: "Please use lodash/{module} import instead",
},
{
name: ".",
message: "Please use explicit import file",
},
],
},
],
curly: ["error", "all"],
"arrow-body-style": ["error", "as-needed"],
},
settings: {
jsdoc: {
ignorePrivate: true,
ignoreInternal: true,
},
},
root: true,
env: {
es6: true,
node: true,
jest: true,
browser: true,
},
parserOptions: {
ecmaVersion: 9,
sourceType: "module",
},
overrides: [
{
files: ["**/*.ts?(x)"],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
},
settings: { "import/resolver": { typescript: {} } },
rules: {
"@typescript-eslint/prefer-optional-chain": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/strict-boolean-expressions": "error",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/camelcase": "off",
"unused-imports/no-unused-imports": "error",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/switch-exhaustiveness-check": "error",
// plugin:prettier/recommended turns off arrow-body-style so it is turned back on here
// But a bug can occur and prettier can provide an invalid code (missing closing parenthesis)
// More details here: https://github.com/prettier/eslint-plugin-prettier#arrow-body-style-and-prefer-arrow-callback-issue
"arrow-body-style": ["error", "as-needed"],
},
},
{
files: ["**/*.test.ts", "scripts/*.ts"],
rules: {
"max-lines": ["off"],
"jsdoc/require-jsdoc": ["off"],
},
},
],
};

1
frontend/node_modules/ts-algebra/.nvmrc generated vendored Normal file
View File

@@ -0,0 +1 @@
16.10.0

4
frontend/node_modules/ts-algebra/.prettierignore generated vendored Normal file
View File

@@ -0,0 +1,4 @@
yarn.lock
**/coverage
**/lib
**/builds

9
frontend/node_modules/ts-algebra/.prettierrc generated vendored Normal file
View File

@@ -0,0 +1,9 @@
{
"singleQuote": false,
"trailingComma": "all",
"arrowParens": "avoid",
"importOrder": ["^~/(.*)$", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderCaseInsensitive": true
}

21
frontend/node_modules/ts-algebra/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Thomas Aribart
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.

737
frontend/node_modules/ts-algebra/README.md generated vendored Normal file
View File

@@ -0,0 +1,737 @@
<img src="assets/header-round-medium.png" width="100%" align="center" />
<p align="right">
<i>If you use this repo, star it ✨</i>
</p>
# Types on steroids 💊
`ts-algebra` exposes a subset of TS types called **Meta-types**: Meta-types are types that encapsulate other types.
```typescript
import { Meta } from "ts-algebra";
type MetaString = Meta.Primitive<string>;
```
The encapsulated type can be retrieved using the `Resolve` operation.
```typescript
type Resolved = Meta.Resolve<MetaString>;
// => string 🙌
```
You can also use the more compact `M` notation:
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Resolved = M.Resolve<
M.Primitive<string>
>;
```
## Okay, but... why ? 🤔
Meta-types allow operations that **are not possible with conventional types**.
For instance, they allow new ["intersect"](#intersect) and ["exclude"](#exclude) operations, and handling objects additional properties:
```typescript
type MyObject = {
str: string; // <= ❌ "str" is assignable to string
[key: string]: number;
};
type MyObjectKeys = keyof MyObject;
// => string <= ❌ Unable to isolate "str"
```
Think of meta-types as a parallel universe where all kinds of magic can happen 🌈 Once your computations are over, you can retrieve the results by resolving them.
<img src="assets/schema.png" width="100%" align="center" />
> Meta-types were originally part of [json-schema-to-ts](https://github.com/ThomasAribart/json-schema-to-ts). Check it to see a real-life usage.
## Table of content
- [Installation](#%EF%B8%8F-installation)
- [Cardinality](#-cardinality)
- [Meta-types](#-meta-types)
- [Never](#never)
- [Any](#any)
- [Const](#const)
- [Enum](#enum)
- [Primitive](#primitive)
- [Array](#array)
- [Tuple](#tuple)
- [Object](#object)
- [Union](#union)
- [Methods](#-methods)
- [Resolve](#resolve)
- [Intersect](#intersect)
- [Exclude](#exclude)
- [Deserialization](#-deserialization)
- [Type constraints](#-type-constraints)
- [Unsafe types](#%EF%B8%8F-unsafe-types-and-methods)
## ☁️ Installation
```bash
# npm
npm install --save-dev ts-algebra
# yarn
yarn add --dev ts-algebra
```
## 🧮 Cardinality
A bit of theory first:
- The [**cardinality**](https://en.wikipedia.org/wiki/Cardinality) of a type is the number of distinct values (potentially infinite) that can be assigned to it
- A meta-type is said **representable** if at least one value can be assigned to its resolved type (cardinality ≥ 1)
An important notion to keep in mind using `ts-algebra`:
---
<p align="center">
<a href="#never"><code>M.Never</code></a> is the only Meta-Type that is non-representable
<br>
<i>(i.e. that resolves to <code>never</code>)</i>
</p>
---
Any other non-representable meta-type (e.g. an object with a non-representable but required property) will be instanciated as `M.Never`.
There are drawbacks to this choice (the said property is hard to find and debug) but stronger benefits: This drastically reduces type computations, in particular in [intersections](#intersect) and [exclusions](#exclude). This is crucial for performances and stability.
## ✨ Meta-types
### Never
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Resolved = M.Resolve<
M.Never
>;
// => never
```
### Any
**Arguments:**
- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)
- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Resolved = M.Resolve<
M.Any
>;
// => unknown
```
### Const
Used for types with [cardinalities](#meta-types) of 1.
**Arguments:**
- <code>Value <i>(type)</i></code>
- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)
- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Resolved = M.Resolve<
M.Const<"I love pizza">
>;
// => "I love pizza"
```
### Enum
Used for types with finite [cardinalities](#meta-types).
**Arguments:**
- <code>Values <i>(type union)</i></code>
- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)
- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Food = M.Resolve<
M.Enum<"pizza" | "tacos" | "fries">
>;
// => "pizza" | "tacos" | "fries"
```
> ☝️ `M.Enum<never>` is [non-representable](#✨-meta-types)
### Primitive
Used for either `string`, `number`, `boolean` or `null`.
**Arguments:**
- <code>Value <i>(string | number | boolean | null)</i></code>
- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)
- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Resolved = M.Resolve<
M.Primitive<string>
>;
// => string
```
### Array
Used for lists of items of the same type.
**Arguments:**
- <code>Items <i>(?meta-type = M.Any)</i></code>
- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)
- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Resolved = M.Resolve<
M.Array
>;
// => unknown[]
type Resolved = M.Resolve<
M.Array<M.Primitive<string>>
>;
// => string[]
```
> ☝️ Any meta-array is representable by `[]`
### Tuple
Used for finite, ordered lists of items of different types.
Meta-tuples can have **additional items**, typed as [`M.Never`](#never) by default. Thus, any meta-tuple is considered **closed** (additional items not allowed), unless a representable additional items meta-type is specified, in which case it becomes **open**.
**Arguments:**
- <code>RequiredItems <i>(meta-type[])</i>:</code>
- <code>AdditionalItems <i>(?meta-type = M.Never)</i></code>: Type of additional items
- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)
- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Resolved = M.Resolve<
M.Tuple<[M.Primitive<string>]>
>;
// => [string]
type Resolved = M.Resolve<
M.Tuple<
[M.Primitive<string>],
M.Primitive<string>
>
>;
// => [string, ...string[]]
```
> ☝️ A meta-tuple is [non-representable](#✨-meta-types) if one of its required items is non-representable
### Object
Used for sets of key-value pairs (properties) which can be required or not.
Meta-objects can have **additional properties**, typed as [`M.Never`](#never) by default. Thus, any meta-object is considered **closed** (additional properties not allowed), unless a representable additional properties meta-type is specified, in which case it becomes **open**.
In presence of named properties, open meta-objects additional properties are resolved as `unknown` to avoid conflicts. However, they are used as long as the meta-type is not resolved (especially in [intersections](#intersect) and [exclusions](#exclude)).
**Arguments:**
- <code>NamedProperties <i>(?{ [key:string]: meta-type } = {})</i></code>
- <code>RequiredPropertiesKeys <i>(?string union = never)</i></code>
- <code>AdditionalProperties <i>(?meta-type = M.Never)</i></code>: The type of additional properties
- <code>CloseOnResolve <i>(?boolean = false)</i></code>: Ignore `AdditionalProperties` at resolution time
- <code>IsSerialized <i>(?boolean = false)</i></code>: See [deserialization](#-deserialization)
- <code>Deserialized <i>(?type = never)</i></code>: See [deserialization](#-deserialization)
```typescript
import { M } from "ts-algebra";
type Resolved = M.Resolve<
M.Object<
{
required: M.Primitive<string>;
notRequired: M.Primitive<null>;
},
"required",
M.Primitive<number>
>
>;
// => {
// req: string,
// notRequired?: null,
// [key: string]: unknown
// }
type ClosedOnResolve = M.Resolve<
M.Object<
{
required: M.Primitive<string>;
notRequired: M.Primitive<null>;
},
"required",
M.Primitive<number>,
false
>
>;
// => {
// req: string,
// notRequired?: null,
// }
```
> ☝️ A meta-object is [non-representable](#✨-meta-types) if one of its required properties value is non-representable:
>
> - If it is a non-representable named property
> - If it is an additional property, and the object is closed
### Union
Used to combine meta-types in a union of meta-types.
**Arguments:**
- <code>Values <i>(meta-type union)</i></code>
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Food = M.Resolve<
M.Union<
| M.Primitive<number>
| M.Enum<"pizza" | "tacos" | "fries">
| M.Const<true>
>
>;
// => number
// | "pizza" | "tacos" | "fries"
// | true
```
> ☝️ A meta-union is [non-representable](#✨-meta-types) if it is empty, or if none of its elements is representable
> ☝️ Along with [M.Never](#never), M.Union is the only meta-type that doesn't support [serialization](#-deserialization)
## 🔧 Methods
### Resolve
Resolves the meta-type to its encapsulated type.
**Arguments:**
- <code>MetaType <i>(meta-type)</i></code>
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Resolved = M.Resolve<
M.Primitive<string>
>;
// => string
```
### Intersect
Takes two meta-types as arguments, and returns their intersection as a meta-type.
**Arguments:**
- <code>LeftMetaType <i>(meta-type)</i></code>
- <code>RightMetaType <i>(meta-type)</i></code>
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Intersected = M.Intersect<
M.Primitive<string>,
M.Enum<"I love pizza"
| ["tacos"]
| { and: "fries" }
>
>
// => M.Enum<"I love pizza">
```
Meta-type intersections differ from conventional intersections:
<!-- prettier-ignore -->
```typescript
type ConventionalIntersection =
{ str: string } & { num: number };
// => { str: string, num: number }
type MetaIntersection = M.Intersect<
M.Object<
{ str: M.Primitive<string> },
"str"
>,
M.Object<
{ num: M.Primitive<number> },
"num"
>
>;
// => M.Never: "num" is required in B
// ...but denied in A
```
Intersections are recursively propagated among tuple items and object properties, and take into account additional items and properties:
<!-- prettier-ignore -->
```typescript
type Intersected = M.Intersect<
M.Tuple<
[M.Primitive<number>],
M.Primitive<string>
>,
M.Tuple<
[M.Enum<"pizza" | 42>],
M.Enum<"fries" | true>
>
>;
// => M.Tuple<
// [M.Enum<42>],
// M.Enum<"fries">
// >
type Intersected = M.Intersect<
M.Object<
{ food: M.Primitive<string> },
"food",
M.Any
>,
M.Object<
{ age: M.Primitive<number> },
"age",
M.Enum<"pizza" | "fries" | 42>
>
>;
// => M.Object<
// {
// food: M.Enum<"pizza" | "fries">,
// age: M.Primitive<number>
// },
// "food" | "age",
// M.Enum<"pizza" | "fries" | 42>
// >
```
Intersections are distributed among unions:
<!-- prettier-ignore -->
```typescript
type Intersected = M.Intersect<
M.Primitive<string>,
M.Union<
| M.Const<"pizza">
| M.Const<42>
>
>;
// => M.Union<
// | M.Const<"pizza">
// | M.Never
// >
```
### Exclude
Takes two meta-types as arguments, and returns their exclusion as a meta-type.
**Arguments:**
- <code>SourceMetaType <i>(meta-type)</i></code>
- <code>ExcludedMetaType <i>(meta-type)</i></code>
<!-- prettier-ignore -->
```typescript
import { M } from "ts-algebra";
type Excluded = M.Exclude<
M.Enum<"I love pizza"
| ["tacos"]
| { and: "fries" }
>,
M.Primitive<string>,
>
// => M.Enum<
// | ["tacos"]
// | { and: "fries" }
// >
```
Meta-type exclusions differ from conventional exclusions:
<!-- prettier-ignore -->
```typescript
type ConventionalExclusion = Exclude<
{ req: string; notReq?: string },
{ req: string }
>;
// => never
// ObjectA is assignable to ObjectB
type MetaExclusion = M.Exclude<
M.Object<
{
req: M.Primitive<string>;
notReq: M.Primitive<string>;
},
"req"
>,
M.Object<
{ req: M.Primitive<string> },
"req"
>
>;
// => ObjectA
// Exclusion is still representable
```
<!-- prettier-ignore -->
```typescript
type ConventionalExclusion = Exclude<
{ food: "pizza" | 42 },
{ [k: string]: number }
>;
// => { food: "pizza" | 42 }
type MetaExclusion = M.Exclude<
M.Object<
{ food: M.Enum<"pizza" | 42> },
"food"
>,
M.Object<
{},
never,
M.Primitive<number>
>
>;
// => M.Object<
// { food: M.Enum<"pizza"> },
// "food"
// >
```
When exclusions can be collapsed on a single item or property, they are recursively propagated among tuple items and object properties, taking into account additional items and properties:
<!-- prettier-ignore -->
```typescript
type Excluded = M.Exclude<
M.Tuple<[M.Enum<"pizza" | 42>]>,
M.Tuple<[M.Primitive<number>]>
>;
// => M.Tuple<[M.Enum<"pizza">]>
type Excluded = M.Exclude<
M.Tuple<
[M.Enum<"pizza" | 42>],
M.Enum<"fries" | true>
>,
M.Tuple<
[M.Primitive<number>],
M.Primitive<string>
>
>;
// => TupleA
// Exclusion is not collapsable on a single item
type Excluded = M.Exclude<
M.Object<
{
reqA: M.Enum<"pizza" | 42>;
reqB: M.Enum<"pizza" | 42>;
},
"reqA" | "reqB"
>,
M.Object<
{},
never,
M.Primitive<number>
>
>;
// => ObjectA
// Exclusion is not collapsable on a single property
```
Exclusions are distributed among unions:
<!-- prettier-ignore -->
```typescript
type Excluded = M.Exclude<
M.Union<
| M.Const<"pizza">
| M.Const<42>
>,
M.Primitive<number>
>;
// => M.Union<
// | M.Const<"pizza">
// | M.Never
// >
```
Excluding a union returns the intersection of the exclusions of all elements, applied separately:
<!-- prettier-ignore -->
```typescript
type Excluded = M.Exclude<
M.Enum<42 | "pizza" | true>,
M.Union<
| M.Primitive<number>
| M.Primitive<boolean>
>
>;
// => M.Enum<"pizza">
```
## 📦 Deserialization
All meta-types except [`M.Never`](#never) and [`M.Union`](#union) can carry an extra type for [deserialization](https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html) purposes. This extra-type will be passed along in operations and override the resolved type.
For instance, it is common to deserialize timestamps as `Date` objects. The last two arguments of [`M.Primitive`](#primitive) can be used to implement this:
<!-- prettier-ignore -->
```typescript
type MetaTimestamp = M.Primitive<
string,
true, // <= enables deserialization (false by default)
Date // <= overrides resolved type
>;
type Resolved = M.Resolve<MetaTimestamp>;
// => Date
```
Note that `MetaTimestamp` will still be considered as a string meta-type until it is resolved: Deserialization only take effect **at resolution time**.
<!-- prettier-ignore -->
```typescript
type Intersected = M.Intersect<
MetaTimestamp,
M.Object<{}, never, M.Any> // <= Date is an object...
>;
// => M.Never
// ...but doesn't intersect Timestamp
```
In representable [intersections](#intersect):
- If no meta-type is serialized, the resulting intersection is not serialized.
- If only one meta-type (left or right) is serialized, the resulting intersection inherits from its deserialization properties.
- If both left and right meta-types are serialized, the resulting intersection inherits from both deserialization properties, through a conventional intersection (`A & B`).
<!-- prettier-ignore -->
```typescript
type MetaBrandedString = M.Primitive<
string,
true,
{ brand: "timestamp" }
>;
type Resolved = M.Resolve<
M.Intersect<
MetaTimestamp,
MetaBrandedString
>
>
// => Date & { brand: "timestamp" }
```
In representable [exclusions](#exclude):
- If the source meta-type is not serialized, the resulting exclusion is not serialized.
- If the source meta-type is serialized, the resulting exclusion inherits of its deserialization properties.
## 🚧 Type constraints
To prevent errors, meta-types inputs are validated against type constraints:
<!-- prettier-ignore -->
```typescript
type Invalid = M.Array<
string // <= ❌ Meta-type expected
>;
```
If you need to use them, all type constraints are also exported:
| Meta-type | Type constraint |
| ------------- | :--------------------------------------------------------------------- |
| `M.Any` | `M.AnyType` = `M.Any` |
| `M.Never` | `M.NeverType` = `M.Never` |
| `M.Const` | `M.ConstType` = `M.Const<any>` |
| `M.Enum` | `M.EnumType` = `M.Enum<any>` |
| `M.Primitive` | `M.PrimitiveType` = `M.Primitive<null \| boolean \| number \| string>` |
| `M.Array` | `M.ArrayType` = `M.Array<M.Type>` |
| `M.Tuple` | `M.TupleType` = `M.Tuple<M.Type[], M.Type>` |
| `M.Object` | `M.ObjectType` = `M.Object<Record<string, M.Type>, string, M.Type>` |
| `M.Union` | `M.UnionType` = `M.Union<M.Type>` |
| - | `M.Type` = Union of the above |
## ✂️ Unsafe types and methods
In deep and self-referencing computations like in [json-schema-to-ts](https://github.com/ThomasAribart/json-schema-to-ts), type constraints can become an issue, as the compiler may not be able to confirm the input type validity ahead of usage.
<!-- prettier-ignore -->
```typescript
type MyArray = M.Array<
VeryDeepTypeComputation<
...
> // <= 💥 Type constraint can break
>
```
For such cases, `ts-algebra` exposes **"unsafe"** types and methods, that behave the same as "safe" ones but removing any type constraints. If you use them, beware: The integrity of the compiling is up to you 😉
| Safe | Unsafe |
| ------------- | -------------- |
| `M.Any` | - |
| `M.Never` | - |
| `M.Const` | - |
| `M.Enum` | - |
| `M.Primitive` | `M.$Primitive` |
| `M.Array` | `M.$Array` |
| `M.Tuple` | `M.$Tuple` |
| `M.Object` | `M.$Object` |
| `M.Union` | `M.$Union` |
| `M.Resolve` | `M.$Resolve` |
| `M.Intersect` | `M.$Intersect` |
| `M.Exclude` | `M.$Exclude` |

2
frontend/node_modules/ts-algebra/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export * as Meta from "./meta-types";
export * as M from "./meta-types";

4
frontend/node_modules/ts-algebra/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import * as Meta_1 from "./meta-types";
export { Meta_1 as Meta };
import * as M_1 from "./meta-types";
export { M_1 as M };

View File

@@ -0,0 +1,15 @@
import type { And, If } from "../utils";
import type { ResolveOptions } from "./resolve";
import type { Deserialized, IsSerialized } from "./utils";
export declare type AnyTypeId = "any";
export declare type Any<IS_SERIALIZED extends boolean = false, DESERIALIZED = never> = {
type: AnyTypeId;
isSerialized: IS_SERIALIZED;
deserialized: DESERIALIZED;
};
export declare type AnyType = {
type: AnyTypeId;
isSerialized: boolean;
deserialized: unknown;
};
export declare type ResolveAny<META_ANY extends AnyType, OPTIONS extends ResolveOptions> = If<And<OPTIONS["deserialize"], IsSerialized<META_ANY>>, Deserialized<META_ANY>, unknown>;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,22 @@
import type { And, If, Prettify } from "../utils";
import type { Any } from "./any";
import type { NeverType } from "./never";
import type { Resolve, ResolveOptions } from "./resolve";
import type { Type } from "./type";
import type { Deserialized, IsSerialized } from "./utils";
export declare type ArrayTypeId = "array";
export declare type _Array<VALUES extends Type = Any, IS_SERIALIZED extends boolean = false, DESERIALIZED = never> = _$Array<VALUES, IS_SERIALIZED, DESERIALIZED>;
export declare type _$Array<VALUES = Any, IS_SERIALIZED = false, DESERIALIZED = never> = {
type: ArrayTypeId;
values: VALUES;
isSerialized: IS_SERIALIZED;
deserialized: DESERIALIZED;
};
export declare type ArrayType = {
type: ArrayTypeId;
values: Type;
isSerialized: boolean;
deserialized: unknown;
};
export declare type ArrayValues<META_ARRAY extends ArrayType> = META_ARRAY["values"];
export declare type ResolveArray<META_ARRAY extends ArrayType, OPTIONS extends ResolveOptions> = If<And<OPTIONS["deserialize"], IsSerialized<META_ARRAY>>, Deserialized<META_ARRAY>, ArrayValues<META_ARRAY> extends NeverType ? [] : Prettify<Resolve<ArrayValues<META_ARRAY>, OPTIONS>[]>>;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,19 @@
import type { And, If, IsNever } from "../utils";
import type { Never } from "./never";
import type { ResolveOptions } from "./resolve";
import type { Deserialized, IsSerialized } from "./utils";
export declare type ConstTypeId = "const";
export declare type Const<VALUE, IS_SERIALIZED extends boolean = false, DESERIALIZED = never> = If<IsNever<VALUE>, Never, {
type: ConstTypeId;
value: VALUE;
isSerialized: IS_SERIALIZED;
deserialized: DESERIALIZED;
}>;
export declare type ConstType = {
type: ConstTypeId;
value: unknown;
isSerialized: boolean;
deserialized: unknown;
};
export declare type ConstValue<META_CONST extends ConstType> = META_CONST["value"];
export declare type ResolveConst<META_CONST extends ConstType, OPTIONS extends ResolveOptions> = If<And<OPTIONS["deserialize"], IsSerialized<META_CONST>>, Deserialized<META_CONST>, ConstValue<META_CONST>>;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,19 @@
import type { And, If, IsNever } from "../utils";
import type { Never } from "./never";
import type { ResolveOptions } from "./resolve";
import type { Deserialized, IsSerialized } from "./utils";
export declare type EnumTypeId = "enum";
export declare type Enum<VALUES, IS_SERIALIZED extends boolean = false, DESERIALIZED = never> = If<IsNever<VALUES>, Never, {
type: EnumTypeId;
values: VALUES;
isSerialized: IS_SERIALIZED;
deserialized: DESERIALIZED;
}>;
export declare type EnumType = {
type: EnumTypeId;
values: unknown;
isSerialized: boolean;
deserialized: unknown;
};
export declare type EnumValues<META_ENUM extends EnumType> = META_ENUM["values"];
export declare type ResolveEnum<META_ENUM extends EnumType, OPTIONS extends ResolveOptions> = If<And<OPTIONS["deserialize"], IsSerialized<META_ENUM>>, Deserialized<META_ENUM>, EnumValues<META_ENUM>>;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,12 @@
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleType } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { ExcludeUnion } from "./union";
export declare type ExcludeFromAny<META_ANY extends AnyType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_ANY : META_TYPE extends AnyType ? Never : META_TYPE extends ConstType ? META_ANY : META_TYPE extends EnumType ? META_ANY : META_TYPE extends PrimitiveType ? META_ANY : META_TYPE extends ArrayType ? META_ANY : META_TYPE extends TupleType ? META_ANY : META_TYPE extends ObjectType ? META_ANY : META_TYPE extends UnionType ? ExcludeUnion<META_ANY, META_TYPE> : Never : Never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,16 @@
import type { And, DoesExtend } from "../../utils";
import type { AnyType } from "../any";
import type { _Array, ArrayType, ArrayValues } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { IsTupleOpen, TupleOpenProps, TupleType, TupleValues } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { _Exclude } from "./index";
import type { ExcludeUnion } from "./union";
export declare type ExcludeFromArray<META_ARRAY extends ArrayType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_ARRAY : META_TYPE extends AnyType ? Never : META_TYPE extends ConstType ? META_ARRAY : META_TYPE extends EnumType ? META_ARRAY : META_TYPE extends PrimitiveType ? META_ARRAY : META_TYPE extends ArrayType ? ExcludeArrays<META_ARRAY, META_TYPE> : META_TYPE extends TupleType ? And<DoesExtend<TupleValues<META_TYPE>, []>, IsTupleOpen<META_TYPE>> extends true ? ExcludeArrays<META_ARRAY, _Array<TupleOpenProps<META_TYPE>>> : META_ARRAY : META_TYPE extends ObjectType ? META_ARRAY : META_TYPE extends UnionType ? ExcludeUnion<META_ARRAY, META_TYPE> : Never : Never;
declare type ExcludeArrays<META_ARRAY_A extends ArrayType, META_ARRAY_B extends ArrayType> = _Exclude<ArrayValues<META_ARRAY_A>, ArrayValues<META_ARRAY_B>> extends NeverType ? NeverType : META_ARRAY_A;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,27 @@
import type { If, IsNever, IsObject } from "../../utils";
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { Const, ConstType, ConstValue } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { IsObjectOpen, ObjectOpenProps, ObjectRequiredKeys, ObjectType, ObjectValues } from "../object";
import type { PrimitiveType } from "../primitive";
import type { Resolve } from "../resolve";
import type { TupleType } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { _Exclude } from "./index";
import type { ExcludeUnion } from "./union";
export declare type ExcludeFromConst<META_CONST extends ConstType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_CONST : META_TYPE extends AnyType ? Never : META_TYPE extends ConstType ? CheckNotExtendsResolved<META_CONST, META_TYPE> : META_TYPE extends EnumType ? CheckNotExtendsResolved<META_CONST, META_TYPE> : META_TYPE extends PrimitiveType ? CheckNotExtendsResolved<META_CONST, META_TYPE> : META_TYPE extends ArrayType ? CheckNotExtendsResolved<META_CONST, META_TYPE> : META_TYPE extends TupleType ? CheckNotExtendsResolved<META_CONST, META_TYPE> : META_TYPE extends ObjectType ? ExcludeObject<META_CONST, META_TYPE> : META_TYPE extends UnionType ? ExcludeUnion<META_CONST, META_TYPE> : Never : Never;
declare type CheckNotExtendsResolved<META_CONST extends ConstType, META_TYPE extends Type> = ConstValue<META_CONST> extends Resolve<META_TYPE, {
deserialize: false;
}> ? Never : META_CONST;
declare type ExcludeObject<META_CONST extends ConstType, META_OBJECT extends ObjectType> = If<IsObject<ConstValue<META_CONST>>, ObjectRequiredKeys<META_OBJECT> extends keyof ConstValue<META_CONST> ? ExcludeObjectFromConst<META_CONST, META_OBJECT> : META_CONST, META_CONST>;
declare type ExcludeObjectFromConst<META_CONST extends ConstType, META_OBJECT extends ObjectType, EXCLUDED_CONST_VALUES = ExcludeConstValues<ConstValue<META_CONST>, META_OBJECT>> = If<IsNever<RepresentableKeys<EXCLUDED_CONST_VALUES>>, Never, META_CONST>;
declare type ExcludeConstValues<VALUE, META_OBJECT extends ObjectType> = {
[KEY in keyof VALUE]: KEY extends keyof ObjectValues<META_OBJECT> ? _Exclude<Const<VALUE[KEY]>, ObjectValues<META_OBJECT>[KEY]> : IsObjectOpen<META_OBJECT> extends true ? _Exclude<Const<VALUE[KEY]>, ObjectOpenProps<META_OBJECT>> : Const<VALUE[KEY]>;
};
declare type RepresentableKeys<VALUES> = {
[KEY in keyof VALUES]: VALUES[KEY] extends Never ? never : KEY;
}[keyof VALUES];
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,20 @@
import type { UnionLast } from "../../utils/unionLast";
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { Const, ConstType } from "../const";
import type { Enum, EnumType, EnumValues } from "../enum";
import type { $Intersect } from "../intersection";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleType } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { _Exclude } from "./index";
import type { ExcludeUnion } from "./union";
export declare type ExcludeFromEnum<META_ENUM extends EnumType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_ENUM : META_TYPE extends AnyType ? Never : META_TYPE extends ConstType ? FilterEnumExcluded<META_ENUM, META_TYPE> : META_TYPE extends EnumType ? FilterEnumExcluded<META_ENUM, META_TYPE> : META_TYPE extends PrimitiveType ? FilterEnumExcluded<META_ENUM, META_TYPE> : META_TYPE extends ArrayType ? FilterEnumExcluded<META_ENUM, META_TYPE> : META_TYPE extends TupleType ? FilterEnumExcluded<META_ENUM, META_TYPE> : META_TYPE extends ObjectType ? FilterEnumExcluded<META_ENUM, META_TYPE> : META_TYPE extends UnionType ? ExcludeUnion<META_ENUM, META_TYPE> : Never : Never;
declare type FilterEnumExcluded<META_ENUM extends EnumType, META_TYPE extends Type> = Enum<FilterEnumExcludedValues<EnumValues<META_ENUM>, META_TYPE>>;
declare type FilterEnumExcludedValues<ENUM_VALUES, META_TYPE extends Type> = ENUM_VALUES extends infer ENUM_VALUE ? _Exclude<Const<ENUM_VALUE>, META_TYPE> extends NeverType ? never : ENUM_VALUE : never;
export declare type ExcludeEnum<META_TYPE extends Type, ENUM_TYPE extends EnumType, ENUM_VALUES = EnumValues<ENUM_TYPE>> = ExcludeEnumValue<META_TYPE, UnionLast<ENUM_VALUES>, ENUM_VALUES>;
declare type ExcludeEnumValue<META_TYPE extends Type, LAST_ENUM_VALUE, ENUM_VALUES> = $Intersect<_Exclude<META_TYPE, Const<LAST_ENUM_VALUE>>, _Exclude<META_TYPE, Enum<Exclude<ENUM_VALUES, LAST_ENUM_VALUE>>>>;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,20 @@
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleType } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { ExcludeFromAny } from "./any";
import type { ExcludeFromArray } from "./array";
import type { ExcludeFromConst } from "./const";
import type { ExcludeFromEnum } from "./enum";
import type { ExcludeFromObject } from "./object";
import type { ExcludeFromPrimitive } from "./primitive";
import type { ExcludeFromTuple } from "./tuple";
import type { ExcludeFromUnion } from "./union";
export declare type _Exclude<META_TYPE_A extends Type, META_TYPE_B extends Type> = _$Exclude<META_TYPE_A, META_TYPE_B>;
export declare type _$Exclude<META_TYPE_A, META_TYPE_B> = META_TYPE_A extends NeverType ? META_TYPE_A : META_TYPE_A extends AnyType ? ExcludeFromAny<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends ConstType ? ExcludeFromConst<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends EnumType ? ExcludeFromEnum<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends PrimitiveType ? ExcludeFromPrimitive<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends ArrayType ? ExcludeFromArray<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends TupleType ? ExcludeFromTuple<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends ObjectType ? ExcludeFromObject<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends UnionType ? ExcludeFromUnion<META_TYPE_A, META_TYPE_B> : Never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,51 @@
import type { And, DoesExtend, If, IsNever, IsObject, Not, Or, UnionPop } from "../../utils";
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { Const, ConstType, ConstValue } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { _Object, IsObjectClosedOnResolve, IsObjectOpen, ObjectOpenProps, ObjectRequiredKeys, ObjectType, ObjectValue, ObjectValues } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleType } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { Deserialized, IsSerialized } from "../utils";
import type { ExcludeEnum } from "./enum";
import type { _$Exclude, _Exclude } from "./index";
import type { ExcludeUnion } from "./union";
import type { ExclusionResult, IsOmittable, IsOutsideOfExcludedScope, IsOutsideOfSourceScope, PropagateExclusion, SourceValue, ValueExclusionResult, ValueExclusionResultType } from "./utils";
export declare type ExcludeFromObject<META_OBJECT extends ObjectType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_OBJECT : META_TYPE extends AnyType ? Never : META_TYPE extends ConstType ? ExcludeConstFromObject<META_OBJECT, META_TYPE> : META_TYPE extends EnumType ? ExcludeEnum<META_OBJECT, META_TYPE> : META_TYPE extends PrimitiveType ? META_OBJECT : META_TYPE extends ArrayType ? META_OBJECT : META_TYPE extends TupleType ? META_OBJECT : META_TYPE extends ObjectType ? ExcludeObjects<META_OBJECT, META_TYPE> : META_TYPE extends UnionType ? ExcludeUnion<META_OBJECT, META_TYPE> : Never : Never;
declare type ExcludeObjects<META_OBJECT_A extends ObjectType, META_OBJECT_B extends ObjectType, VALUE_EXCLUSION_RESULTS extends Record<string, ValueExclusionResultType> = ExcludeObjectValues<META_OBJECT_A, META_OBJECT_B>, REPRESENTABLE_KEYS extends string = RepresentableKeys<VALUE_EXCLUSION_RESULTS>, OPEN_PROPS_EXCLUSION = _Exclude<ObjectOpenProps<META_OBJECT_A>, ObjectOpenProps<META_OBJECT_B>>> = DoesObjectSizesMatch<META_OBJECT_A, META_OBJECT_B, VALUE_EXCLUSION_RESULTS> extends true ? {
moreThanTwo: META_OBJECT_A;
onlyOne: PropagateExclusions<META_OBJECT_A, VALUE_EXCLUSION_RESULTS>;
none: OmitOmittableKeys<META_OBJECT_A, VALUE_EXCLUSION_RESULTS>;
}[And<IsObjectOpen<META_OBJECT_A>, Not<DoesExtend<OPEN_PROPS_EXCLUSION, NeverType>>> extends true ? "moreThanTwo" : GetUnionLength<REPRESENTABLE_KEYS>] : META_OBJECT_A;
declare type ExcludeObjectValues<META_OBJECT_A extends ObjectType, META_OBJECT_B extends ObjectType> = {
[KEY in Extract<keyof ObjectValues<META_OBJECT_A> | keyof ObjectValues<META_OBJECT_B> | ObjectRequiredKeys<META_OBJECT_A> | ObjectRequiredKeys<META_OBJECT_B>, string>]: ValueExclusionResult<ObjectValue<META_OBJECT_A, KEY>, IsAllowedIn<META_OBJECT_A, KEY>, IsRequiredIn<META_OBJECT_A, KEY>, ObjectValue<META_OBJECT_B, KEY>, IsAllowedIn<META_OBJECT_B, KEY>, IsRequiredIn<META_OBJECT_B, KEY>>;
};
declare type GetUnionLength<UNION> = If<IsNever<UNION>, "none", If<IsNever<UnionPop<UNION>>, "onlyOne", "moreThanTwo">>;
declare type IsAllowedIn<META_OBJECT extends ObjectType, KEY extends string> = Or<DoesExtend<KEY, keyof ObjectValues<META_OBJECT>>, IsObjectOpen<META_OBJECT>>;
declare type IsRequiredIn<META_OBJECT extends ObjectType, KEY extends string> = DoesExtend<KEY, ObjectRequiredKeys<META_OBJECT>>;
declare type DoesObjectSizesMatch<META_OBJECT_A extends ObjectType, META_OBJECT_B extends ObjectType, VALUE_EXCLUSION_RESULTS extends Record<string, ValueExclusionResultType>> = If<And<IsObjectOpen<META_OBJECT_A>, Not<IsObjectOpen<META_OBJECT_B>>>, false, And<IsExcludedSmallEnough<VALUE_EXCLUSION_RESULTS>, IsExcludedBigEnough<VALUE_EXCLUSION_RESULTS>>>;
declare type IsExcludedSmallEnough<VALUE_EXCLUSION_RESULTS extends Record<string, ValueExclusionResultType>> = Not<DoesExtend<true, {
[KEY in keyof VALUE_EXCLUSION_RESULTS]: IsOutsideOfSourceScope<VALUE_EXCLUSION_RESULTS[KEY]>;
}[keyof VALUE_EXCLUSION_RESULTS]>>;
declare type IsExcludedBigEnough<VALUE_EXCLUSION_RESULTS extends Record<string, ValueExclusionResultType>> = Not<DoesExtend<true, {
[KEY in keyof VALUE_EXCLUSION_RESULTS]: IsOutsideOfExcludedScope<VALUE_EXCLUSION_RESULTS[KEY]>;
}[keyof VALUE_EXCLUSION_RESULTS]>>;
declare type RepresentableKeys<VALUE_EXCLUSION_RESULTS extends Record<string, ValueExclusionResultType>> = {
[KEY in Extract<keyof VALUE_EXCLUSION_RESULTS, string>]: ExclusionResult<VALUE_EXCLUSION_RESULTS[KEY]> extends NeverType ? never : KEY;
}[Extract<keyof VALUE_EXCLUSION_RESULTS, string>];
declare type PropagateExclusions<META_OBJECT extends ObjectType, VALUE_EXCLUSION_RESULTS extends Record<string, ValueExclusionResultType>> = _Object<{
[KEY in keyof VALUE_EXCLUSION_RESULTS]: PropagateExclusion<VALUE_EXCLUSION_RESULTS[KEY]>;
}, ObjectRequiredKeys<META_OBJECT>, ObjectOpenProps<META_OBJECT>, IsObjectClosedOnResolve<META_OBJECT>, IsSerialized<META_OBJECT>, Deserialized<META_OBJECT>>;
declare type OmitOmittableKeys<META_OBJECT extends ObjectType, VALUE_EXCLUSION_RESULTS extends Record<string, ValueExclusionResultType>, OMITTABLE_KEYS extends string = OmittableKeys<VALUE_EXCLUSION_RESULTS>, OMITTABLE_KEYS_COUNT extends string = GetUnionLength<OMITTABLE_KEYS>> = OMITTABLE_KEYS_COUNT extends "moreThanTwo" ? META_OBJECT : OMITTABLE_KEYS_COUNT extends "onlyOne" ? _Object<{
[KEY in keyof VALUE_EXCLUSION_RESULTS]: KEY extends OMITTABLE_KEYS ? Never : SourceValue<VALUE_EXCLUSION_RESULTS[KEY]>;
}, ObjectRequiredKeys<META_OBJECT>, ObjectOpenProps<META_OBJECT>, IsObjectClosedOnResolve<META_OBJECT>, IsSerialized<META_OBJECT>, Deserialized<META_OBJECT>> : Never;
declare type OmittableKeys<VALUE_EXCLUSION_RESULTS extends Record<string, ValueExclusionResultType>> = {
[KEY in Extract<keyof VALUE_EXCLUSION_RESULTS, string>]: IsOmittable<VALUE_EXCLUSION_RESULTS[KEY]> extends true ? KEY : never;
}[Extract<keyof VALUE_EXCLUSION_RESULTS, string>];
declare type ExcludeConstFromObject<META_OBJECT extends ObjectType, META_CONST extends ConstType, CONST_VALUE = ConstValue<META_CONST>> = If<IsObject<CONST_VALUE>, _$Exclude<META_OBJECT, _Object<{
[KEY in Extract<keyof CONST_VALUE, string>]: Const<CONST_VALUE[KEY]>;
}, Extract<keyof CONST_VALUE, string>, Never, IsObjectClosedOnResolve<META_OBJECT>, IsSerialized<META_CONST>, Deserialized<META_CONST>>>, META_OBJECT>;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,12 @@
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType, PrimitiveValue } from "../primitive";
import type { TupleType } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { ExcludeUnion } from "./union";
export declare type ExcludeFromPrimitive<META_PRIMITIVE extends PrimitiveType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_PRIMITIVE : META_TYPE extends AnyType ? Never : META_TYPE extends ConstType ? META_PRIMITIVE : META_TYPE extends EnumType ? META_PRIMITIVE : META_TYPE extends PrimitiveType ? PrimitiveValue<META_PRIMITIVE> extends PrimitiveValue<META_TYPE> ? Never : META_PRIMITIVE : META_TYPE extends ArrayType ? META_PRIMITIVE : META_TYPE extends TupleType ? META_PRIMITIVE : META_TYPE extends ObjectType ? META_PRIMITIVE : META_TYPE extends UnionType ? ExcludeUnion<META_PRIMITIVE, META_TYPE> : Never : Never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,87 @@
import type { And, DoesExtend, If, Not, Tail } from "../../utils";
import type { AnyType } from "../any";
import type { ArrayType, ArrayValues } from "../array";
import type { Const, ConstType, ConstValue } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { $Tuple, IsTupleOpen, Tuple, TupleOpenProps, TupleType, TupleValues } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { Deserialized, IsSerialized } from "../utils";
import type { ExcludeEnum } from "./enum";
import type { _Exclude } from "./index";
import type { ExcludeUnion } from "./union";
import type { ExclusionResult, IsOmittable, IsOutsideOfExcludedScope, IsOutsideOfSourceScope, PropagateExclusion, SourceValue, ValueExclusionResult, ValueExclusionResultType } from "./utils";
export declare type ExcludeFromTuple<META_TUPLE extends TupleType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_TUPLE : META_TYPE extends AnyType ? Never : META_TYPE extends ConstType ? ExcludeConst<META_TUPLE, META_TYPE> : META_TYPE extends EnumType ? ExcludeEnum<META_TUPLE, META_TYPE> : META_TYPE extends PrimitiveType ? META_TUPLE : META_TYPE extends ArrayType ? ExcludeArray<META_TUPLE, META_TYPE> : META_TYPE extends TupleType ? ExcludeTuples<META_TUPLE, META_TYPE> : META_TYPE extends ObjectType ? META_TUPLE : META_TYPE extends UnionType ? ExcludeUnion<META_TUPLE, META_TYPE> : Never : Never;
declare type ExcludeArray<META_TUPLE extends TupleType, META_ARRAY extends ArrayType> = ExcludeTuples<META_TUPLE, Tuple<[
], ArrayValues<META_ARRAY>, IsSerialized<META_ARRAY>, Deserialized<META_ARRAY>>>;
declare type ExcludeTuples<META_TUPLE_A extends TupleType, META_TUPLE_B extends TupleType, VALUE_EXCLUSION_RESULTS extends ValueExclusionResultType[] = ExcludeTupleValues<TupleValues<META_TUPLE_A>, TupleValues<META_TUPLE_B>, IsTupleOpen<META_TUPLE_A>, IsTupleOpen<META_TUPLE_B>, TupleOpenProps<META_TUPLE_A>, TupleOpenProps<META_TUPLE_B>>, REPRESENTABLE_VALUE_EXCLUSION_RESULTS extends ValueExclusionResultType[] = RepresentableExcludedValues<VALUE_EXCLUSION_RESULTS>, EXCLUDED_OPEN_PROPS = _Exclude<TupleOpenProps<META_TUPLE_A>, TupleOpenProps<META_TUPLE_B>>, IS_OPEN_PROPS_EXCLUSION_REPRESENTABLE = Not<DoesExtend<EXCLUDED_OPEN_PROPS, NeverType>>> = If<DoesTupleSizesMatch<META_TUPLE_A, META_TUPLE_B, VALUE_EXCLUSION_RESULTS>, {
moreThanTwo: META_TUPLE_A;
onlyOne: $Tuple<PropagateExclusions<VALUE_EXCLUSION_RESULTS>, TupleOpenProps<META_TUPLE_A>, IsSerialized<META_TUPLE_A>, Deserialized<META_TUPLE_A>>;
none: OmitOmittableExcludedItems<META_TUPLE_A, VALUE_EXCLUSION_RESULTS>;
}[And<IsTupleOpen<META_TUPLE_A>, IS_OPEN_PROPS_EXCLUSION_REPRESENTABLE> extends true ? "moreThanTwo" : GetTupleLength<REPRESENTABLE_VALUE_EXCLUSION_RESULTS>], META_TUPLE_A>;
declare type ExcludeTupleValues<META_TUPLE_A_VALUES extends Type[], META_TUPLE_B_VALUES extends Type[], IS_META_TUPLE_A_OPEN extends boolean, IS_META_TUPLE_B_OPEN extends boolean, META_TUPLE_A_OPEN_PROPS extends Type, META_TUPLE_B_OPEN_PROPS extends Type, VALUE_EXCLUSION_RESULTS extends ValueExclusionResultType[] = []> = META_TUPLE_A_VALUES extends [
infer META_TUPLE_A_VALUES_HEAD,
...infer META_TUPLE_A_VALUES_TAIL
] ? META_TUPLE_A_VALUES_HEAD extends Type ? META_TUPLE_A_VALUES_TAIL extends Type[] ? META_TUPLE_B_VALUES extends [
infer META_TUPLE_B_VALUES_HEAD,
...infer META_TUPLE_B_VALUES_TAIL
] ? META_TUPLE_B_VALUES_HEAD extends Type ? META_TUPLE_B_VALUES_TAIL extends Type[] ? ExcludeTupleValues<META_TUPLE_A_VALUES_TAIL, META_TUPLE_B_VALUES_TAIL, IS_META_TUPLE_A_OPEN, IS_META_TUPLE_B_OPEN, META_TUPLE_A_OPEN_PROPS, META_TUPLE_B_OPEN_PROPS, [
...VALUE_EXCLUSION_RESULTS,
ValueExclusionResult<META_TUPLE_A_VALUES_HEAD, true, true, META_TUPLE_B_VALUES_HEAD, true, true>
]> : never : never : ExcludeTupleValues<META_TUPLE_A_VALUES_TAIL, [
], IS_META_TUPLE_A_OPEN, IS_META_TUPLE_B_OPEN, META_TUPLE_A_OPEN_PROPS, META_TUPLE_B_OPEN_PROPS, [
...VALUE_EXCLUSION_RESULTS,
ValueExclusionResult<META_TUPLE_A_VALUES_HEAD, true, true, META_TUPLE_B_OPEN_PROPS, IS_META_TUPLE_B_OPEN, false>
]> : never : never : META_TUPLE_B_VALUES extends [
infer META_TUPLE_B_VALUES_HEAD,
...infer META_TUPLE_B_VALUES_TAIL
] ? META_TUPLE_B_VALUES_HEAD extends Type ? META_TUPLE_B_VALUES_TAIL extends Type[] ? ExcludeTupleValues<[
], META_TUPLE_B_VALUES_TAIL, IS_META_TUPLE_A_OPEN, IS_META_TUPLE_B_OPEN, META_TUPLE_A_OPEN_PROPS, META_TUPLE_B_OPEN_PROPS, [
...VALUE_EXCLUSION_RESULTS,
ValueExclusionResult<META_TUPLE_A_OPEN_PROPS, IS_META_TUPLE_A_OPEN, false, META_TUPLE_B_VALUES_HEAD, true, true>
]> : never : never : VALUE_EXCLUSION_RESULTS;
declare type GetTupleLength<ANY_TUPLE extends unknown[], TAIL extends unknown[] = Tail<ANY_TUPLE>> = If<DoesExtend<ANY_TUPLE, []>, "none", If<DoesExtend<TAIL, []>, "onlyOne", "moreThanTwo">>;
declare type DoesTupleSizesMatch<META_TUPLE_A extends TupleType, META_TUPLE_B extends TupleType, VALUE_EXCLUSION_RESULTS extends ValueExclusionResultType[]> = If<And<IsTupleOpen<META_TUPLE_A>, Not<IsTupleOpen<META_TUPLE_B>>>, false, And<IsExcludedSmallEnough<VALUE_EXCLUSION_RESULTS>, IsExcludedBigEnough<VALUE_EXCLUSION_RESULTS>>>;
declare type IsExcludedSmallEnough<VALUE_EXCLUSION_RESULTS extends ValueExclusionResultType[]> = VALUE_EXCLUSION_RESULTS extends [
infer VALUE_EXCLUSION_RESULTS_HEAD,
...infer VALUE_EXCLUSION_RESULTS_TAIL
] ? VALUE_EXCLUSION_RESULTS_HEAD extends ValueExclusionResultType ? VALUE_EXCLUSION_RESULTS_TAIL extends ValueExclusionResultType[] ? If<IsOutsideOfSourceScope<VALUE_EXCLUSION_RESULTS_HEAD>, false, IsExcludedSmallEnough<VALUE_EXCLUSION_RESULTS_TAIL>> : never : never : true;
declare type IsExcludedBigEnough<VALUE_EXCLUSION_RESULTS extends ValueExclusionResultType[]> = VALUE_EXCLUSION_RESULTS extends [
infer VALUE_EXCLUSION_RESULTS_HEAD,
...infer VALUE_EXCLUSION_RESULTS_TAIL
] ? VALUE_EXCLUSION_RESULTS_HEAD extends ValueExclusionResultType ? VALUE_EXCLUSION_RESULTS_TAIL extends ValueExclusionResultType[] ? If<IsOutsideOfExcludedScope<VALUE_EXCLUSION_RESULTS_HEAD>, false, IsExcludedBigEnough<VALUE_EXCLUSION_RESULTS_TAIL>> : never : never : true;
declare type RepresentableExcludedValues<VALUE_EXCLUSION_RESULTS extends ValueExclusionResultType[], REPRESENTABLE_VALUE_EXCLUSION_RESULTS extends ValueExclusionResultType[] = []> = VALUE_EXCLUSION_RESULTS extends [
infer VALUE_EXCLUSION_RESULTS_HEAD,
...infer VALUE_EXCLUSION_RESULTS_TAIL
] ? VALUE_EXCLUSION_RESULTS_HEAD extends ValueExclusionResultType ? VALUE_EXCLUSION_RESULTS_TAIL extends ValueExclusionResultType[] ? ExclusionResult<VALUE_EXCLUSION_RESULTS_HEAD> extends NeverType ? RepresentableExcludedValues<VALUE_EXCLUSION_RESULTS_TAIL, REPRESENTABLE_VALUE_EXCLUSION_RESULTS> : RepresentableExcludedValues<VALUE_EXCLUSION_RESULTS_TAIL, [
...REPRESENTABLE_VALUE_EXCLUSION_RESULTS,
VALUE_EXCLUSION_RESULTS_HEAD
]> : never : never : REPRESENTABLE_VALUE_EXCLUSION_RESULTS;
declare type PropagateExclusions<VALUE_EXCLUSION_RESULTS extends ValueExclusionResultType[], RESULT extends unknown[] = []> = VALUE_EXCLUSION_RESULTS extends [
infer VALUE_EXCLUSION_RESULTS_HEAD,
...infer VALUE_EXCLUSION_RESULTS_TAIL
] ? VALUE_EXCLUSION_RESULTS_HEAD extends ValueExclusionResultType ? VALUE_EXCLUSION_RESULTS_TAIL extends ValueExclusionResultType[] ? PropagateExclusions<VALUE_EXCLUSION_RESULTS_TAIL, [
...RESULT,
PropagateExclusion<VALUE_EXCLUSION_RESULTS_HEAD>
]> : never : never : RESULT;
declare type OmitOmittableExcludedItems<META_TUPLE extends TupleType, ITEM_EXCLUSION_RESULTS extends ValueExclusionResultType[], OMITTABLE_ITEM_EXCLUSION_RESULTS extends ValueExclusionResultType[] = OmittableExcludedItems<ITEM_EXCLUSION_RESULTS>, OMITTABLE_ITEMS_COUNT extends string = GetTupleLength<OMITTABLE_ITEM_EXCLUSION_RESULTS>> = OMITTABLE_ITEMS_COUNT extends "moreThanTwo" ? META_TUPLE : OMITTABLE_ITEMS_COUNT extends "onlyOne" ? $Tuple<RequiredExcludedItems<ITEM_EXCLUSION_RESULTS>, Never, IsSerialized<META_TUPLE>, Deserialized<META_TUPLE>> : Never;
declare type OmittableExcludedItems<ITEM_EXCLUSION_RESULTS extends ValueExclusionResultType[], RESULT extends ValueExclusionResultType[] = []> = ITEM_EXCLUSION_RESULTS extends [
infer VALUE_EXCLUSION_RESULTS_HEAD,
...infer VALUE_EXCLUSION_RESULTS_TAIL
] ? VALUE_EXCLUSION_RESULTS_HEAD extends ValueExclusionResultType ? VALUE_EXCLUSION_RESULTS_TAIL extends ValueExclusionResultType[] ? If<IsOmittable<VALUE_EXCLUSION_RESULTS_HEAD>, OmittableExcludedItems<VALUE_EXCLUSION_RESULTS_TAIL, [
...RESULT,
VALUE_EXCLUSION_RESULTS_HEAD
]>, OmittableExcludedItems<VALUE_EXCLUSION_RESULTS_TAIL, RESULT>> : never : never : RESULT;
declare type RequiredExcludedItems<ITEM_EXCLUSION_RESULTS extends ValueExclusionResultType[], RESULT extends Type[] = []> = ITEM_EXCLUSION_RESULTS extends [
infer VALUE_EXCLUSION_RESULTS_HEAD,
...infer VALUE_EXCLUSION_RESULTS_TAIL
] ? VALUE_EXCLUSION_RESULTS_HEAD extends ValueExclusionResultType ? VALUE_EXCLUSION_RESULTS_TAIL extends ValueExclusionResultType[] ? IsOmittable<VALUE_EXCLUSION_RESULTS_HEAD> extends true ? RESULT : RequiredExcludedItems<VALUE_EXCLUSION_RESULTS_TAIL, [
...RESULT,
SourceValue<VALUE_EXCLUSION_RESULTS_HEAD>
]> : never : never : RESULT;
declare type ExcludeConst<META_TUPLE extends TupleType, META_CONST extends ConstType, META_CONST_VALUE = ConstValue<META_CONST>> = META_CONST_VALUE extends unknown[] ? _Exclude<META_TUPLE, $Tuple<ExtractConstValues<META_CONST_VALUE>, Never, IsSerialized<META_CONST>, Deserialized<META_CONST>>> : META_TUPLE;
declare type ExtractConstValues<CONST_VALUES extends unknown[], RESULT extends unknown[] = []> = CONST_VALUES extends [infer CONST_VALUES_HEAD, ...infer CONST_VALUES_TAIL] ? ExtractConstValues<CONST_VALUES_TAIL, [...RESULT, Const<CONST_VALUES_HEAD>]> : RESULT;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,8 @@
import type { If, IsNever, UnionLast } from "../../utils";
import type { $Intersect } from "../intersection";
import type { $Union, UnionType, UnionValues } from "../union";
import type { _$Exclude } from "./index";
export declare type ExcludeFromUnion<META_UNION extends UnionType, META_TYPE> = $Union<UnionValues<META_UNION> extends infer META_UNION_VALUE ? _$Exclude<META_UNION_VALUE, META_TYPE> : never>;
export declare type ExcludeUnion<META_TYPE, META_UNION extends UnionType> = If<IsNever<UnionValues<META_UNION>>, META_TYPE, RecurseOnUnionValues<META_TYPE, UnionLast<UnionValues<META_UNION>>, META_UNION>>;
declare type RecurseOnUnionValues<META_TYPE, META_UNION_VALUE, META_UNION extends UnionType> = $Intersect<_$Exclude<META_TYPE, META_UNION_VALUE>, _$Exclude<META_TYPE, $Union<Exclude<UnionValues<META_UNION>, META_UNION_VALUE>>>>;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,31 @@
import type { And, Not } from "../../utils";
import type { NeverType } from "../never";
import type { Type } from "../type";
import type { _$Exclude } from "./index";
export declare type ValueExclusionResult<VALUE_A extends Type, IS_ALLOWED_IN_A extends boolean, IS_REQUIRED_IN_A extends boolean, VALUE_B extends Type, IS_ALLOWED_IN_B extends boolean, IS_REQUIRED_IN_B extends boolean> = {
sourceValue: VALUE_A;
isAllowedInSource: IS_ALLOWED_IN_A;
isRequiredInSource: IS_REQUIRED_IN_A;
isAllowedInExcluded: IS_ALLOWED_IN_B;
isRequiredInExcluded: IS_REQUIRED_IN_B;
exclusionResult: _$Exclude<VALUE_A, VALUE_B>;
};
export declare type ValueExclusionResultType = {
sourceValue: Type;
isAllowedInSource: boolean;
isRequiredInSource: boolean;
isAllowedInExcluded: boolean;
isRequiredInExcluded: boolean;
exclusionResult: any;
};
export declare type SourceValue<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = VALUE_EXCLUSION_RESULT["sourceValue"];
declare type IsAllowedInSource<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = VALUE_EXCLUSION_RESULT["isAllowedInSource"];
declare type IsRequiredInSource<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = VALUE_EXCLUSION_RESULT["isRequiredInSource"];
export declare type ExclusionResult<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = VALUE_EXCLUSION_RESULT["exclusionResult"];
declare type IsAllowedInExcluded<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = VALUE_EXCLUSION_RESULT["isAllowedInExcluded"];
declare type IsRequiredInExcluded<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = VALUE_EXCLUSION_RESULT["isRequiredInExcluded"];
export declare type IsOutsideOfSourceScope<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = And<Not<IsAllowedInSource<VALUE_EXCLUSION_RESULT>>, IsRequiredInExcluded<VALUE_EXCLUSION_RESULT>>;
export declare type IsOutsideOfExcludedScope<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = And<IsRequiredInSource<VALUE_EXCLUSION_RESULT>, Not<IsAllowedInExcluded<VALUE_EXCLUSION_RESULT>>>;
export declare type IsOmittable<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = And<Not<IsRequiredInSource<VALUE_EXCLUSION_RESULT>>, IsRequiredInExcluded<VALUE_EXCLUSION_RESULT>>;
export declare type PropagateExclusion<VALUE_EXCLUSION_RESULT extends ValueExclusionResultType> = ExclusionResult<VALUE_EXCLUSION_RESULT> extends NeverType ? SourceValue<VALUE_EXCLUSION_RESULT> : ExclusionResult<VALUE_EXCLUSION_RESULT>;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,14 @@
import type { Any, AnyType } from "./any";
import type { _$Array, _Array, ArrayType } from "./array";
import type { Const, ConstType } from "./const";
import type { Enum, EnumType } from "./enum";
import type { _$Exclude, _Exclude } from "./exclusion";
import type { $Intersect, Intersect } from "./intersection";
import type { Never, NeverType } from "./never";
import type { _$Object, _Object, ObjectType } from "./object";
import type { $Primitive, Primitive, PrimitiveType } from "./primitive";
import type { $Resolve, Resolve } from "./resolve";
import type { $Tuple, Tuple, TupleType } from "./tuple";
import type { Type } from "./type";
import type { $Union, Union, UnionType } from "./union";
export type { Never, Any, Const, Enum, Primitive, $Primitive, _Array as Array, _$Array as $Array, Tuple, $Tuple, _Object as Object, _$Object as $Object, Union, $Union, NeverType, AnyType, ConstType, EnumType, PrimitiveType, ArrayType, TupleType, ObjectType, UnionType, Type, $Resolve, Resolve, $Intersect, Intersect, _$Exclude as $Exclude, _Exclude as Exclude, };

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,19 @@
import type { Any, AnyType } from "../any";
import type { ArrayType, ArrayValues } from "../array";
import type { ConstType } from "../const";
import type { EnumType, EnumValues } from "../enum";
import type { Never, NeverType } from "../never";
import type { IsObjectClosedOnResolve, ObjectOpenProps, ObjectRequiredKeys, ObjectType, ObjectValues } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleOpenProps, TupleType, TupleValues } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { IntersectArraySerializationParams } from "./array";
import type { IntersectConstSerializationParams } from "./const";
import type { IntersectEnumSerializationParams } from "./enum";
import type { IntersectObjectSerializationParams } from "./object";
import type { IntersectPrimitiveSerializationParams } from "./primitive";
import type { IntersectTupleSerializationParams } from "./tuple";
import type { DistributeIntersection } from "./union";
import type { IntersectDeserialized, IntersectIsSerialized } from "./utils";
export declare type IntersectAny<META_ANY extends AnyType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_TYPE : META_TYPE extends AnyType ? Any<IntersectIsSerialized<META_ANY, META_TYPE>, IntersectDeserialized<META_ANY, META_TYPE>> : META_TYPE extends ConstType ? IntersectConstSerializationParams<META_TYPE, META_ANY> : META_TYPE extends EnumType ? IntersectEnumSerializationParams<EnumValues<META_TYPE>, META_TYPE, META_ANY> : META_TYPE extends PrimitiveType ? IntersectPrimitiveSerializationParams<META_TYPE, META_ANY> : META_TYPE extends ArrayType ? IntersectArraySerializationParams<ArrayValues<META_TYPE>, META_TYPE, META_ANY> : META_TYPE extends TupleType ? IntersectTupleSerializationParams<TupleValues<META_TYPE>, TupleOpenProps<META_TYPE>, META_TYPE, META_ANY> : META_TYPE extends ObjectType ? IntersectObjectSerializationParams<ObjectValues<META_TYPE>, ObjectRequiredKeys<META_TYPE>, ObjectOpenProps<META_TYPE>, IsObjectClosedOnResolve<META_TYPE>, META_TYPE, META_ANY> : META_TYPE extends UnionType ? DistributeIntersection<META_TYPE, META_ANY> : Never : Never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,21 @@
import type { AnyType } from "../any";
import type { _$Array, ArrayType, ArrayValues } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleType } from "../tuple";
import type { SerializableType, Type } from "../type";
import type { UnionType } from "../union";
import type { IntersectConstToArray } from "./const";
import type { IntersectEnumToArray } from "./enum";
import type { Intersect } from "./index";
import type { IntersectTupleToArray } from "./tuple";
import type { DistributeIntersection } from "./union";
import type { IntersectDeserialized, IntersectIsSerialized } from "./utils";
export declare type IntersectArraySerializationParams<VALUES extends Type, META_ARRAY extends ArrayType, SERIALIZABLE_META_TYPE extends SerializableType> = $MergeArrayValuesToSerializable<VALUES, META_ARRAY, SERIALIZABLE_META_TYPE>;
declare type $MergeArrayValuesToSerializable<VALUES, META_ARRAY extends ArrayType, SERIALIZABLE_META_TYPE extends SerializableType> = _$Array<VALUES, IntersectIsSerialized<META_ARRAY, SERIALIZABLE_META_TYPE>, IntersectDeserialized<META_ARRAY, SERIALIZABLE_META_TYPE>>;
export declare type IntersectArray<META_ARRAY extends ArrayType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_TYPE : META_TYPE extends AnyType ? IntersectArraySerializationParams<ArrayValues<META_ARRAY>, META_ARRAY, META_TYPE> : META_TYPE extends ConstType ? IntersectConstToArray<META_TYPE, META_ARRAY> : META_TYPE extends EnumType ? IntersectEnumToArray<META_TYPE, META_ARRAY> : META_TYPE extends PrimitiveType ? Never : META_TYPE extends ArrayType ? IntersectArrays<META_ARRAY, META_TYPE> : META_TYPE extends TupleType ? IntersectTupleToArray<META_TYPE, META_ARRAY> : META_TYPE extends ObjectType ? Never : META_TYPE extends UnionType ? DistributeIntersection<META_TYPE, META_ARRAY> : Never : Never;
declare type IntersectArrays<META_ARRAY_A extends ArrayType, META_ARRAY_B extends ArrayType> = $MergeArrayValuesToSerializable<Intersect<ArrayValues<META_ARRAY_A>, ArrayValues<META_ARRAY_B>>, META_ARRAY_A, META_ARRAY_B>;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,33 @@
import type { If, IsNever, IsObject } from "../../utils";
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { Const, ConstType, ConstValue } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectRequiredKeys, ObjectType, ObjectValue } from "../object";
import type { PrimitiveType } from "../primitive";
import type { Resolve } from "../resolve";
import type { TupleType } from "../tuple";
import type { SerializableType, Type } from "../type";
import type { UnionType } from "../union";
import type { Intersect } from "./index";
import type { DistributeIntersection } from "./union";
import type { IntersectDeserialized, IntersectIsSerialized } from "./utils";
export declare type IntersectConstSerializationParams<META_CONST extends ConstType, SERIALIZABLE_META_TYPE extends SerializableType> = Const<ConstValue<META_CONST>, IntersectIsSerialized<META_CONST, SERIALIZABLE_META_TYPE>, IntersectDeserialized<META_CONST, SERIALIZABLE_META_TYPE>>;
export declare type IntersectConst<META_CONST extends ConstType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_TYPE : META_TYPE extends AnyType ? IntersectConstSerializationParams<META_CONST, META_TYPE> : META_TYPE extends ConstType ? CheckExtendsResolved<META_CONST, META_TYPE> : META_TYPE extends EnumType ? IntersectConstToEnum<META_CONST, META_TYPE> : META_TYPE extends PrimitiveType ? IntersectConstToPrimitive<META_CONST, META_TYPE> : META_TYPE extends ArrayType ? IntersectConstToArray<META_CONST, META_TYPE> : META_TYPE extends TupleType ? IntersectConstToTuple<META_CONST, META_TYPE> : META_TYPE extends ObjectType ? IntersectConstToObject<META_CONST, META_TYPE> : META_TYPE extends UnionType ? DistributeIntersection<META_TYPE, META_CONST> : Never : Never;
declare type CheckExtendsResolved<META_CONST extends ConstType, SERIALIZABLE_META_TYPE extends SerializableType> = ConstValue<META_CONST> extends Resolve<SERIALIZABLE_META_TYPE, {
deserialize: false;
}> ? IntersectConstSerializationParams<META_CONST, SERIALIZABLE_META_TYPE> : Never;
export declare type IntersectConstToEnum<META_CONST extends ConstType, META_ENUM extends EnumType> = CheckExtendsResolved<META_CONST, META_ENUM>;
export declare type IntersectConstToPrimitive<META_CONST extends ConstType, META_PRIMITIVE extends PrimitiveType> = CheckExtendsResolved<META_CONST, META_PRIMITIVE>;
export declare type IntersectConstToArray<META_CONST extends ConstType, META_ARRAY extends ArrayType> = CheckExtendsResolved<META_CONST, META_ARRAY>;
export declare type IntersectConstToTuple<META_CONST extends ConstType, META_TUPLE extends TupleType> = CheckExtendsResolved<META_CONST, META_TUPLE>;
export declare type IntersectConstToObject<META_CONST extends ConstType, META_OBJECT extends ObjectType> = If<IsObject<ConstValue<META_CONST>>, IntersectObjectConstToObject<META_CONST, META_OBJECT>, Never>;
declare type IntersectObjectConstToObject<META_CONST extends ConstType, META_OBJECT extends ObjectType, INTERSECTED_META_OBJECT = IntersectConstValuesToObjectValues<ConstValue<META_CONST>, META_OBJECT>> = If<IsNever<NeverKeys<INTERSECTED_META_OBJECT>>, IntersectConstSerializationParams<META_CONST, META_OBJECT>, Never>;
declare type IntersectConstValuesToObjectValues<CONST_VALUE, META_OBJECT extends ObjectType> = {
[KEY in Extract<keyof CONST_VALUE | ObjectRequiredKeys<META_OBJECT>, string>]: KEY extends keyof CONST_VALUE ? Intersect<Const<CONST_VALUE[KEY]>, ObjectValue<META_OBJECT, KEY>> : Never;
};
declare type NeverKeys<META_OBJECT> = {
[KEY in keyof META_OBJECT]: META_OBJECT[KEY] extends Never ? KEY : never;
}[keyof META_OBJECT];
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,23 @@
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { Const, ConstType } from "../const";
import type { Enum, EnumType, EnumValues } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleType } from "../tuple";
import type { SerializableType, Type } from "../type";
import type { UnionType } from "../union";
import type { IntersectConstToEnum } from "./const";
import type { $Intersect } from "./index";
import type { DistributeIntersection } from "./union";
import type { IntersectDeserialized, IntersectIsSerialized } from "./utils";
export declare type IntersectEnumSerializationParams<META_ENUM_VALUES, META_ENUM extends EnumType, SERIALIZABLE_META_TYPE extends SerializableType> = Enum<META_ENUM_VALUES, IntersectIsSerialized<META_ENUM, SERIALIZABLE_META_TYPE>, IntersectDeserialized<META_ENUM, SERIALIZABLE_META_TYPE>>;
export declare type IntersectEnum<META_ENUM extends EnumType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_TYPE : META_TYPE extends AnyType ? IntersectEnumSerializationParams<EnumValues<META_ENUM>, META_ENUM, META_TYPE> : META_TYPE extends ConstType ? IntersectConstToEnum<META_TYPE, META_ENUM> : META_TYPE extends EnumType ? FilterEnum<META_ENUM, META_TYPE> : META_TYPE extends PrimitiveType ? IntersectEnumToPrimitive<META_ENUM, META_TYPE> : META_TYPE extends ArrayType ? FilterEnum<META_ENUM, META_TYPE> : META_TYPE extends TupleType ? FilterEnum<META_ENUM, META_TYPE> : META_TYPE extends ObjectType ? FilterEnum<META_ENUM, META_TYPE> : META_TYPE extends UnionType ? DistributeIntersection<META_TYPE, META_ENUM> : Never : Never;
declare type FilterEnum<META_ENUM extends EnumType, SERIALIZABLE_META_TYPE extends SerializableType> = IntersectEnumSerializationParams<FilterEnumValues<EnumValues<META_ENUM>, SERIALIZABLE_META_TYPE>, META_ENUM, SERIALIZABLE_META_TYPE>;
declare type FilterEnumValues<ENUM_VALUES, SERIALIZABLE_META_TYPE> = ENUM_VALUES extends infer ENUM_VALUE ? $Intersect<Const<ENUM_VALUE>, SERIALIZABLE_META_TYPE> extends Never ? never : ENUM_VALUE : never;
export declare type IntersectEnumToPrimitive<META_ENUM extends EnumType, META_PRIMITIVE extends PrimitiveType> = FilterEnum<META_ENUM, META_PRIMITIVE>;
export declare type IntersectEnumToArray<META_ENUM extends EnumType, META_ARRAY extends ArrayType> = FilterEnum<META_ENUM, META_ARRAY>;
export declare type IntersectEnumToTuple<META_ENUM extends EnumType, META_TUPLE extends TupleType> = FilterEnum<META_ENUM, META_TUPLE>;
export declare type IntersectEnumToObject<META_ENUM extends EnumType, META_OBJECT extends ObjectType> = FilterEnum<META_ENUM, META_OBJECT>;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,20 @@
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleType } from "../tuple";
import type { Type } from "../type";
import type { UnionType } from "../union";
import type { IntersectAny } from "./any";
import type { IntersectArray } from "./array";
import type { IntersectConst } from "./const";
import type { IntersectEnum } from "./enum";
import type { IntersectObject } from "./object";
import type { IntersectPrimitive } from "./primitive";
import type { IntersectTuple } from "./tuple";
import type { IntersectUnion } from "./union";
export declare type Intersect<META_TYPE_A extends Type, META_TYPE_B extends Type> = $Intersect<META_TYPE_A, META_TYPE_B>;
export declare type $Intersect<META_TYPE_A, META_TYPE_B> = META_TYPE_A extends NeverType ? META_TYPE_A : META_TYPE_A extends AnyType ? IntersectAny<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends ConstType ? IntersectConst<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends EnumType ? IntersectEnum<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends PrimitiveType ? IntersectPrimitive<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends ArrayType ? IntersectArray<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends TupleType ? IntersectTuple<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends ObjectType ? IntersectObject<META_TYPE_A, META_TYPE_B> : META_TYPE_A extends UnionType ? IntersectUnion<META_TYPE_A, META_TYPE_B> : Never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,26 @@
import type { Or } from "../../utils";
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { _$Object, IsObjectClosedOnResolve, ObjectOpenProps, ObjectRequiredKeys, ObjectType, ObjectValue, ObjectValues } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleType } from "../tuple";
import type { SerializableType, Type } from "../type";
import type { UnionType } from "../union";
import type { IntersectConstToObject } from "./const";
import type { IntersectEnumToObject } from "./enum";
import type { $Intersect, Intersect } from "./index";
import type { DistributeIntersection } from "./union";
import type { IntersectDeserialized, IntersectIsSerialized } from "./utils";
export declare type IntersectObjectSerializationParams<VALUES extends Record<string, Type>, REQUIRED_KEYS extends string, OPEN_PROPS extends Type, CLOSE_ON_RESOLVE extends boolean, META_OBJECT extends ObjectType, SERIALIZABLE_META_TYPE extends SerializableType> = $MergeObjectPropsToSerializable<VALUES, REQUIRED_KEYS, OPEN_PROPS, CLOSE_ON_RESOLVE, META_OBJECT, SERIALIZABLE_META_TYPE>;
declare type $MergeObjectPropsToSerializable<VALUES, REQUIRED_KEYS, OPEN_PROPS, CLOSE_ON_RESOLVE, META_OBJECT extends ObjectType, SERIALIZABLE_META_TYPE extends SerializableType> = _$Object<VALUES, REQUIRED_KEYS, OPEN_PROPS, CLOSE_ON_RESOLVE, IntersectIsSerialized<META_OBJECT, SERIALIZABLE_META_TYPE>, IntersectDeserialized<META_OBJECT, SERIALIZABLE_META_TYPE>>;
export declare type IntersectObject<META_OBJECT extends ObjectType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_TYPE : META_TYPE extends AnyType ? IntersectObjectSerializationParams<ObjectValues<META_OBJECT>, ObjectRequiredKeys<META_OBJECT>, ObjectOpenProps<META_OBJECT>, IsObjectClosedOnResolve<META_OBJECT>, META_OBJECT, META_TYPE> : META_TYPE extends ConstType ? IntersectConstToObject<META_TYPE, META_OBJECT> : META_TYPE extends EnumType ? IntersectEnumToObject<META_TYPE, META_OBJECT> : META_TYPE extends PrimitiveType ? Never : META_TYPE extends ArrayType ? Never : META_TYPE extends TupleType ? Never : META_TYPE extends ObjectType ? IntersectObjects<META_OBJECT, META_TYPE> : META_TYPE extends UnionType ? DistributeIntersection<META_TYPE, META_OBJECT> : Never : Never;
declare type IntersectObjects<META_OBJECT_A extends ObjectType, META_OBJECT_B extends ObjectType, INTERSECTED_VALUES extends Record<string, unknown> = IntersectObjectsValues<META_OBJECT_A, META_OBJECT_B>, INTERSECTED_OPEN_PROPS = Intersect<ObjectOpenProps<META_OBJECT_A>, ObjectOpenProps<META_OBJECT_B>>, INTERSECTED_CLOSE_ON_RESOLVE = Or<IsObjectClosedOnResolve<META_OBJECT_A>, IsObjectClosedOnResolve<META_OBJECT_B>>> = $MergeObjectPropsToSerializable<{
[KEY in keyof INTERSECTED_VALUES]: INTERSECTED_VALUES[KEY];
}, ObjectRequiredKeys<META_OBJECT_A> | ObjectRequiredKeys<META_OBJECT_B>, INTERSECTED_OPEN_PROPS, INTERSECTED_CLOSE_ON_RESOLVE, META_OBJECT_A, META_OBJECT_B>;
declare type IntersectObjectsValues<META_OBJECT_A extends ObjectType, META_OBJECT_B extends ObjectType> = {
[KEY in Extract<keyof ObjectValues<META_OBJECT_A> | keyof ObjectValues<META_OBJECT_B>, string>]: $Intersect<ObjectValue<META_OBJECT_A, KEY>, ObjectValue<META_OBJECT_B, KEY>>;
};
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,17 @@
import type { And, DoesExtend, If } from "../../utils";
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { Primitive, PrimitiveType, PrimitiveValue } from "../primitive";
import type { TupleType } from "../tuple";
import type { SerializableType, Type } from "../type";
import type { UnionType } from "../union";
import type { IntersectConstToPrimitive } from "./const";
import type { IntersectEnumToPrimitive } from "./enum";
import type { DistributeIntersection } from "./union";
import type { IntersectDeserialized, IntersectIsSerialized } from "./utils";
export declare type IntersectPrimitiveSerializationParams<META_PRIMITIVE extends PrimitiveType, SERIALIZABLE_META_TYPE extends SerializableType> = Primitive<PrimitiveValue<META_PRIMITIVE>, IntersectIsSerialized<META_PRIMITIVE, SERIALIZABLE_META_TYPE>, IntersectDeserialized<META_PRIMITIVE, SERIALIZABLE_META_TYPE>>;
export declare type IntersectPrimitive<META_PRIMITIVE extends PrimitiveType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_TYPE : META_TYPE extends AnyType ? IntersectPrimitiveSerializationParams<META_PRIMITIVE, META_TYPE> : META_TYPE extends ConstType ? IntersectConstToPrimitive<META_TYPE, META_PRIMITIVE> : META_TYPE extends EnumType ? IntersectEnumToPrimitive<META_TYPE, META_PRIMITIVE> : META_TYPE extends PrimitiveType ? If<And<DoesExtend<PrimitiveValue<META_PRIMITIVE>, PrimitiveValue<META_TYPE>>, DoesExtend<PrimitiveValue<META_TYPE>, PrimitiveValue<META_PRIMITIVE>>>, IntersectPrimitiveSerializationParams<META_PRIMITIVE, META_TYPE>, Never> : META_TYPE extends ArrayType ? Never : META_TYPE extends TupleType ? Never : META_TYPE extends ObjectType ? Never : META_TYPE extends UnionType ? DistributeIntersection<META_TYPE, META_PRIMITIVE> : Never : Never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,44 @@
import type { AnyType } from "../any";
import type { ArrayType, ArrayValues } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { $Tuple, IsTupleOpen, TupleOpenProps, TupleType, TupleValues } from "../tuple";
import type { SerializableType, Type } from "../type";
import type { UnionType } from "../union";
import type { IntersectConstToTuple } from "./const";
import type { IntersectEnumToTuple } from "./enum";
import type { $Intersect, Intersect } from "./index";
import type { DistributeIntersection } from "./union";
import type { IntersectDeserialized, IntersectIsSerialized } from "./utils";
export declare type IntersectTupleSerializationParams<VALUES extends Type[], OPEN_PROPS extends Type, META_TUPLE extends TupleType, SERIALIZABLE_META_TYPE extends SerializableType> = $MergeTuplePropsToSerializable<VALUES, OPEN_PROPS, META_TUPLE, SERIALIZABLE_META_TYPE>;
declare type $MergeTuplePropsToSerializable<VALUES, OPEN_PROPS, META_TUPLE extends TupleType, SERIALIZABLE_META_TYPE extends SerializableType> = $Tuple<VALUES, OPEN_PROPS, IntersectIsSerialized<META_TUPLE, SERIALIZABLE_META_TYPE>, IntersectDeserialized<META_TUPLE, SERIALIZABLE_META_TYPE>>;
export declare type IntersectTuple<META_TUPLE extends TupleType, META_TYPE> = META_TYPE extends NeverType ? META_TYPE : META_TYPE extends AnyType ? IntersectTupleSerializationParams<TupleValues<META_TUPLE>, TupleOpenProps<META_TUPLE>, META_TUPLE, META_TYPE> : META_TYPE extends ConstType ? IntersectConstToTuple<META_TYPE, META_TUPLE> : META_TYPE extends EnumType ? IntersectEnumToTuple<META_TYPE, META_TUPLE> : META_TYPE extends PrimitiveType ? Never : META_TYPE extends ArrayType ? IntersectTupleToArray<META_TUPLE, META_TYPE> : META_TYPE extends TupleType ? IntersectTuples<META_TUPLE, META_TYPE> : META_TYPE extends ObjectType ? Never : META_TYPE extends UnionType ? DistributeIntersection<META_TYPE, META_TUPLE> : Never;
export declare type IntersectTupleToArray<META_TUPLE extends TupleType, META_ARRAY extends ArrayType, INTERSECTED_VALUES extends unknown[] = IntersectTupleToArrayValues<TupleValues<META_TUPLE>, ArrayValues<META_ARRAY>>, INTERSECTED_OPEN_PROPS = $Intersect<TupleOpenProps<META_TUPLE>, ArrayValues<META_ARRAY>>> = $MergeTuplePropsToSerializable<INTERSECTED_VALUES, INTERSECTED_OPEN_PROPS, META_TUPLE, META_ARRAY>;
declare type IntersectTupleToArrayValues<TUPLE_VALUES extends Type[], ARRAY_VALUES extends Type, RESULT extends unknown[] = []> = TUPLE_VALUES extends [infer TUPLE_VALUES_HEAD, ...infer TUPLE_VALUES_TAIL] ? TUPLE_VALUES_HEAD extends Type ? TUPLE_VALUES_TAIL extends Type[] ? IntersectTupleToArrayValues<TUPLE_VALUES_TAIL, ARRAY_VALUES, [
...RESULT,
Intersect<TUPLE_VALUES_HEAD, ARRAY_VALUES>
]> : never : never : RESULT;
declare type IntersectTuples<META_TUPLE_A extends TupleType, META_TUPLE_B extends TupleType, INTERSECTED_VALUES extends unknown[] = IntersectTupleValues<TupleValues<META_TUPLE_A>, TupleValues<META_TUPLE_B>, IsTupleOpen<META_TUPLE_A>, IsTupleOpen<META_TUPLE_B>, TupleOpenProps<META_TUPLE_A>, TupleOpenProps<META_TUPLE_B>>, INTERSECTED_OPEN_PROPS = $Intersect<TupleOpenProps<META_TUPLE_A>, TupleOpenProps<META_TUPLE_B>>> = $MergeTuplePropsToSerializable<INTERSECTED_VALUES, INTERSECTED_OPEN_PROPS, META_TUPLE_A, META_TUPLE_B>;
declare type IntersectTupleValues<TUPLE_A_VALUES extends Type[], TUPLE_B_VALUES extends Type[], TUPLE_A_IS_OPEN extends boolean, TUPLE_B_IS_OPEN extends boolean, TUPLE_A_OPEN_PROPS extends Type, TUPLE_B_OPEN_PROPS extends Type, RESULT extends unknown[] = []> = TUPLE_A_VALUES extends [
infer TUPLE_A_VALUES_HEAD,
...infer TUPLE_A_VALUES_TAIL
] ? TUPLE_A_VALUES_HEAD extends Type ? TUPLE_A_VALUES_TAIL extends Type[] ? TUPLE_B_VALUES extends [
infer TUPLE_B_VALUES_HEAD,
...infer TUPLE_B_VALUES_TAIL
] ? TUPLE_B_VALUES_HEAD extends Type ? TUPLE_B_VALUES_TAIL extends Type[] ? IntersectTupleValues<TUPLE_A_VALUES_TAIL, TUPLE_B_VALUES_TAIL, TUPLE_A_IS_OPEN, TUPLE_B_IS_OPEN, TUPLE_A_OPEN_PROPS, TUPLE_B_OPEN_PROPS, [
...RESULT,
Intersect<TUPLE_A_VALUES_HEAD, TUPLE_B_VALUES_HEAD>
]> : never : never : IntersectTupleValues<TUPLE_A_VALUES_TAIL, TUPLE_B_VALUES, TUPLE_A_IS_OPEN, TUPLE_B_IS_OPEN, TUPLE_A_OPEN_PROPS, TUPLE_B_OPEN_PROPS, [
...RESULT,
TUPLE_B_IS_OPEN extends true ? Intersect<TUPLE_A_VALUES_HEAD, TUPLE_B_OPEN_PROPS> : Never
]> : never : never : TUPLE_B_VALUES extends [
infer TUPLE_B_VALUES_HEAD,
...infer TUPLE_B_VALUES_TAIL
] ? TUPLE_B_VALUES_HEAD extends Type ? TUPLE_B_VALUES_TAIL extends Type[] ? IntersectTupleValues<TUPLE_A_VALUES, TUPLE_B_VALUES_TAIL, TUPLE_A_IS_OPEN, TUPLE_B_IS_OPEN, TUPLE_A_OPEN_PROPS, TUPLE_B_OPEN_PROPS, [
...RESULT,
TUPLE_A_IS_OPEN extends true ? Intersect<TUPLE_B_VALUES_HEAD, TUPLE_A_OPEN_PROPS> : Never
]> : never : never : RESULT;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,13 @@
import type { AnyType } from "../any";
import type { ArrayType } from "../array";
import type { ConstType } from "../const";
import type { EnumType } from "../enum";
import type { Never, NeverType } from "../never";
import type { ObjectType } from "../object";
import type { PrimitiveType } from "../primitive";
import type { TupleType } from "../tuple";
import type { Type } from "../type";
import type { $Union, UnionType, UnionValues } from "../union";
import type { $Intersect } from "./index";
export declare type IntersectUnion<META_UNION extends UnionType, META_TYPE> = META_TYPE extends Type ? META_TYPE extends NeverType ? META_TYPE : META_TYPE extends AnyType ? META_UNION : META_TYPE extends ConstType ? DistributeIntersection<META_UNION, META_TYPE> : META_TYPE extends EnumType ? DistributeIntersection<META_UNION, META_TYPE> : META_TYPE extends PrimitiveType ? DistributeIntersection<META_UNION, META_TYPE> : META_TYPE extends ArrayType ? DistributeIntersection<META_UNION, META_TYPE> : META_TYPE extends TupleType ? DistributeIntersection<META_UNION, META_TYPE> : META_TYPE extends ObjectType ? DistributeIntersection<META_UNION, META_TYPE> : META_TYPE extends UnionType ? DistributeIntersection<META_UNION, META_TYPE> : Never : Never;
export declare type DistributeIntersection<META_UNION extends UnionType, META_TYPE> = $Union<UnionValues<META_UNION> extends infer UNION_VALUE ? $Intersect<UNION_VALUE, META_TYPE> : never>;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,5 @@
import type { If, Or } from "../../utils";
import type { SerializableType } from "../type";
import type { Deserialized, IsSerialized } from "../utils";
export declare type IntersectIsSerialized<SERIALIZABLE_META_TYPE_A extends SerializableType, SERIALIZABLE_META_TYPE_B extends SerializableType> = Or<IsSerialized<SERIALIZABLE_META_TYPE_A>, IsSerialized<SERIALIZABLE_META_TYPE_B>>;
export declare type IntersectDeserialized<SERIALIZABLE_META_TYPE_A extends SerializableType, SERIALIZABLE_META_TYPE_B extends SerializableType> = If<IsSerialized<SERIALIZABLE_META_TYPE_A>, If<IsSerialized<SERIALIZABLE_META_TYPE_B>, Deserialized<SERIALIZABLE_META_TYPE_A> & Deserialized<SERIALIZABLE_META_TYPE_B>, Deserialized<SERIALIZABLE_META_TYPE_A>>, If<IsSerialized<SERIALIZABLE_META_TYPE_B>, Deserialized<SERIALIZABLE_META_TYPE_B>>>;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,6 @@
export declare type NeverTypeId = "never";
export declare type Never = {
type: NeverTypeId;
};
export declare type NeverType = Never;
export declare type ResolveNever = never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,47 @@
import type { And, DeepMergeUnsafe, DoesExtend, If, IsNever, Not } from "../utils";
import type { Any } from "./any";
import type { Never, NeverType } from "./never";
import type { Resolve, ResolveOptions } from "./resolve";
import type { Type } from "./type";
import type { Deserialized, IsSerialized } from "./utils";
export declare type ObjectTypeId = "object";
export declare type _Object<VALUES extends Record<string, Type> = {}, REQUIRED_KEYS extends string = never, OPEN_PROPS extends Type = Never, CLOSE_ON_RESOLVE extends boolean = false, IS_SERIALIZED extends boolean = false, DESERIALIZED = never> = _$Object<VALUES, REQUIRED_KEYS, OPEN_PROPS, CLOSE_ON_RESOLVE, IS_SERIALIZED, DESERIALIZED>;
export declare type _$Object<VALUES = {}, REQUIRED_KEYS = never, OPEN_PROPS = Never, CLOSE_ON_RESOLVE = false, IS_SERIALIZED = false, DESERIALIZED = never> = DoesExtend<true, {
[KEY in Extract<REQUIRED_KEYS, string>]: KEY extends keyof VALUES ? DoesExtend<VALUES[KEY], NeverType> : DoesExtend<OPEN_PROPS, NeverType>;
}[Extract<REQUIRED_KEYS, string>]> extends true ? Never : {
type: ObjectTypeId;
values: VALUES;
required: REQUIRED_KEYS;
isOpen: Not<DoesExtend<OPEN_PROPS, NeverType>>;
openProps: OPEN_PROPS;
closeOnResolve: CLOSE_ON_RESOLVE;
isSerialized: IS_SERIALIZED;
deserialized: DESERIALIZED;
};
export declare type ObjectType = {
type: ObjectTypeId;
values: Record<string, Type>;
required: string;
isOpen: boolean;
openProps: Type;
closeOnResolve: boolean;
isSerialized: boolean;
deserialized: unknown;
};
export declare type ObjectValues<META_OBJECT extends ObjectType> = META_OBJECT["values"];
export declare type ObjectValue<META_OBJECT extends ObjectType, KEY extends string> = KEY extends keyof ObjectValues<META_OBJECT> ? ObjectValues<META_OBJECT>[KEY] : IsObjectOpen<META_OBJECT> extends true ? ObjectOpenProps<META_OBJECT> : Never;
export declare type ObjectRequiredKeys<META_OBJECT extends ObjectType> = META_OBJECT["required"];
export declare type IsObjectOpen<META_OBJECT extends ObjectType> = META_OBJECT["isOpen"];
export declare type ObjectOpenProps<META_OBJECT extends ObjectType> = META_OBJECT["openProps"];
export declare type IsObjectClosedOnResolve<META_OBJECT extends ObjectType> = META_OBJECT["closeOnResolve"];
declare type IsObjectEmpty<META_OBJECT extends ObjectType> = IsNever<keyof ObjectValues<META_OBJECT>>;
export declare type ResolveObject<META_OBJECT extends ObjectType, OPTIONS extends ResolveOptions> = If<And<OPTIONS["deserialize"], IsSerialized<META_OBJECT>>, Deserialized<META_OBJECT>, DeepMergeUnsafe<If<And<IsObjectOpen<META_OBJECT>, Not<IsObjectClosedOnResolve<META_OBJECT>>>, If<IsObjectEmpty<META_OBJECT>, {
[KEY: string]: Resolve<ObjectOpenProps<META_OBJECT>, OPTIONS>;
}, {
[KEY: string]: Resolve<Any, OPTIONS>;
}>, {}>, DeepMergeUnsafe<{
[KEY in Exclude<keyof ObjectValues<META_OBJECT>, ObjectRequiredKeys<META_OBJECT>>]?: Resolve<ObjectValues<META_OBJECT>[KEY], OPTIONS>;
}, {
[KEY in ObjectRequiredKeys<META_OBJECT>]: KEY extends keyof ObjectValues<META_OBJECT> ? Resolve<ObjectValues<META_OBJECT>[KEY], OPTIONS> : Resolve<Any, OPTIONS>;
}>>>;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,20 @@
import type { And, If, IsNever } from "../utils";
import type { Never } from "./never";
import type { ResolveOptions } from "./resolve";
import type { Deserialized, IsSerialized } from "./utils";
export declare type PrimitiveTypeId = "primitive";
export declare type Primitive<VALUE extends null | boolean | number | string, IS_SERIALIZED extends boolean = false, DESERIALIZED = never> = $Primitive<VALUE, IS_SERIALIZED, DESERIALIZED>;
export declare type $Primitive<VALUE, IS_SERIALIZED = false, DESERIALIZED = never> = If<IsNever<VALUE>, Never, {
type: PrimitiveTypeId;
value: VALUE;
isSerialized: IS_SERIALIZED;
deserialized: DESERIALIZED;
}>;
export declare type PrimitiveType = {
type: PrimitiveTypeId;
value: null | boolean | number | string;
isSerialized: boolean;
deserialized: unknown;
};
export declare type PrimitiveValue<META_PRIMITIVE extends PrimitiveType> = META_PRIMITIVE["value"];
export declare type ResolvePrimitive<META_PRIMITIVE extends PrimitiveType, OPTIONS extends ResolveOptions> = If<And<OPTIONS["deserialize"], IsSerialized<META_PRIMITIVE>>, Deserialized<META_PRIMITIVE>, PrimitiveValue<META_PRIMITIVE>>;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,18 @@
import type { AnyType, ResolveAny } from "./any";
import type { ArrayType, ResolveArray } from "./array";
import type { ConstType, ResolveConst } from "./const";
import type { EnumType, ResolveEnum } from "./enum";
import type { NeverType, ResolveNever } from "./never";
import type { ObjectType, ResolveObject } from "./object";
import type { PrimitiveType, ResolvePrimitive } from "./primitive";
import type { ResolveTuple, TupleType } from "./tuple";
import type { Type } from "./type";
import type { ResolveUnion, UnionType } from "./union";
export declare type ResolveOptions = {
deserialize: boolean;
};
export declare type ResolveDefaultOptions = {
deserialize: true;
};
export declare type Resolve<META_TYPE extends Type, OPTIONS extends ResolveOptions = ResolveDefaultOptions> = $Resolve<META_TYPE, OPTIONS>;
export declare type $Resolve<META_TYPE, OPTIONS extends ResolveOptions = ResolveDefaultOptions> = META_TYPE extends AnyType ? ResolveAny<META_TYPE, OPTIONS> : META_TYPE extends NeverType ? ResolveNever : META_TYPE extends ConstType ? ResolveConst<META_TYPE, OPTIONS> : META_TYPE extends EnumType ? ResolveEnum<META_TYPE, OPTIONS> : META_TYPE extends PrimitiveType ? ResolvePrimitive<META_TYPE, OPTIONS> : META_TYPE extends ArrayType ? ResolveArray<META_TYPE, OPTIONS> : META_TYPE extends TupleType ? ResolveTuple<META_TYPE, OPTIONS> : META_TYPE extends ObjectType ? ResolveObject<META_TYPE, OPTIONS> : META_TYPE extends UnionType ? ResolveUnion<META_TYPE, OPTIONS> : never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,39 @@
import type { And, DoesExtend, If, Not } from "../utils";
import type { Never, NeverType } from "./never";
import type { Resolve, ResolveOptions } from "./resolve";
import type { Type } from "./type";
import type { Deserialized, IsSerialized } from "./utils";
export declare type TupleTypeId = "tuple";
export declare type Tuple<VALUES extends Type[], OPEN_PROPS extends Type = Never, IS_SERIALIZED extends boolean = false, DESERIALIZED = never> = $Tuple<VALUES, OPEN_PROPS, IS_SERIALIZED, DESERIALIZED>;
export declare type $Tuple<VALUES, OPEN_PROPS = Never, IS_SERIALIZED = false, DESERIALIZED = never> = IsAnyValueNever<VALUES> extends true ? Never : {
type: TupleTypeId;
values: VALUES;
isOpen: Not<DoesExtend<OPEN_PROPS, NeverType>>;
openProps: OPEN_PROPS;
isSerialized: IS_SERIALIZED;
deserialized: DESERIALIZED;
};
declare type IsAnyValueNever<TUPLE> = TUPLE extends [
infer TUPLE_HEAD,
...infer TUPLE_TAIL
] ? TUPLE_HEAD extends NeverType ? true : IsAnyValueNever<TUPLE_TAIL> : false;
export declare type TupleType = {
type: TupleTypeId;
values: Type[];
isOpen: boolean;
openProps: Type;
isSerialized: boolean;
deserialized: unknown;
};
export declare type TupleValues<META_TUPLE extends TupleType> = META_TUPLE["values"];
export declare type IsTupleOpen<META_TUPLE extends TupleType> = META_TUPLE["isOpen"];
export declare type TupleOpenProps<META_TUPLE extends TupleType> = META_TUPLE["openProps"];
export declare type ResolveTuple<META_TUPLE extends TupleType, OPTIONS extends ResolveOptions> = If<And<OPTIONS["deserialize"], IsSerialized<META_TUPLE>>, Deserialized<META_TUPLE>, If<IsTupleOpen<META_TUPLE>, [
...RecurseOnTuple<TupleValues<META_TUPLE>, OPTIONS>,
...Resolve<TupleOpenProps<META_TUPLE>, OPTIONS>[]
], RecurseOnTuple<TupleValues<META_TUPLE>, OPTIONS>>>;
declare type RecurseOnTuple<VALUES extends Type[], OPTIONS extends ResolveOptions, RESULT extends unknown[] = []> = VALUES extends [infer VALUES_HEAD, ...infer VALUES_TAIL] ? VALUES_HEAD extends Type ? VALUES_TAIL extends Type[] ? RecurseOnTuple<VALUES_TAIL, OPTIONS, [
...RESULT,
Resolve<VALUES_HEAD, OPTIONS>
]> : never : never : RESULT;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,14 @@
import type { AnyType } from "./any";
import type { ArrayType } from "./array";
import type { ConstType } from "./const";
import type { EnumType } from "./enum";
import type { NeverType } from "./never";
import type { ObjectType } from "./object";
import type { PrimitiveType } from "./primitive";
import type { TupleType } from "./tuple";
import type { UnionType } from "./union";
export declare type Type = NeverType | AnyType | ConstType | EnumType | PrimitiveType | ArrayType | TupleType | ObjectType | UnionType;
export declare type SerializableType = Type extends infer META_TYPE ? META_TYPE extends {
isSerialized: boolean;
deserialized: unknown;
} ? META_TYPE : never : never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,10 @@
import type { AnyTypeId } from "./any";
import type { ArrayTypeId } from "./array";
import type { ConstTypeId } from "./const";
import type { EnumTypeId } from "./enum";
import type { NeverTypeId } from "./never";
import type { ObjectTypeId } from "./object";
import type { PrimitiveTypeId } from "./primitive";
import type { TupleTypeId } from "./tuple";
import type { UnionTypeId } from "./union";
export declare type TypeId = NeverTypeId | AnyTypeId | ConstTypeId | EnumTypeId | PrimitiveTypeId | ArrayTypeId | TupleTypeId | ObjectTypeId | UnionTypeId;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,18 @@
import type { DoesExtend, If, IsNever } from "../utils";
import type { Never, NeverType } from "./never";
import type { $Resolve, ResolveOptions } from "./resolve";
import type { Type } from "./type";
export declare type UnionTypeId = "union";
export declare type Union<VALUES extends Type> = $Union<VALUES>;
export declare type $Union<VALUES> = If<IsNever<VALUES>, Never, DoesExtend<VALUES, NeverType> extends true ? Never : {
type: UnionTypeId;
values: VALUES;
}>;
export declare type UnionType = {
type: UnionTypeId;
values: Type;
};
export declare type UnionValues<META_UNION extends UnionType> = META_UNION["values"];
export declare type ResolveUnion<META_UNION extends UnionType, OPTIONS extends ResolveOptions> = RecurseOnUnion<UnionValues<META_UNION>, OPTIONS>;
declare type RecurseOnUnion<VALUES extends Type, OPTIONS extends ResolveOptions> = VALUES extends infer META_TYPE ? $Resolve<META_TYPE, OPTIONS> : never;
export {};

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,3 @@
import type { SerializableType } from "./type";
export declare type IsSerialized<SERIALIZABLE_META_TYPE extends SerializableType> = SERIALIZABLE_META_TYPE["isSerialized"];
export declare type Deserialized<SERIALIZABLE_META_TYPE extends SerializableType> = SERIALIZABLE_META_TYPE["deserialized"];

View File

@@ -0,0 +1 @@
export {};

1
frontend/node_modules/ts-algebra/lib/utils/and.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare type And<BOOL_A, BOOL_B> = BOOL_A extends true ? BOOL_B extends true ? true : false : false;

1
frontend/node_modules/ts-algebra/lib/utils/and.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,5 @@
export declare type DoesExtend<TYPE_A, TYPE_B> = [TYPE_A] extends [TYPE_B] ? true : false;
declare type ArrayKeys = keyof [];
export declare type IsObject<TYPE> = TYPE extends object ? ArrayKeys extends Extract<keyof TYPE, ArrayKeys> ? false : true : false;
export declare type IsArray<TYPE> = TYPE extends object ? ArrayKeys extends Extract<keyof TYPE, ArrayKeys> ? true : false : false;
export {};

View File

@@ -0,0 +1 @@
export {};

1
frontend/node_modules/ts-algebra/lib/utils/if.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare type If<CONDITION extends boolean, THEN, ELSE = never> = CONDITION extends true ? THEN : ELSE;

1
frontend/node_modules/ts-algebra/lib/utils/if.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

12
frontend/node_modules/ts-algebra/lib/utils/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
export type { And } from "./and";
export type { DoesExtend, IsObject, IsArray } from "./extends";
export type { If } from "./if";
export type { IntersectUnion } from "./intersectUnion";
export type { IsNever } from "./isNever";
export type { DeepMergeUnsafe } from "./merge";
export type { Not } from "./not";
export type { Or } from "./or";
export type { Prettify } from "./prettify";
export type { Tail } from "./tail";
export type { UnionLast } from "./unionLast";
export type { UnionPop } from "./unionPop";

1
frontend/node_modules/ts-algebra/lib/utils/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1 @@
export declare type IntersectUnion<UNION> = (UNION extends unknown ? (arg: UNION) => void : never) extends (arg: infer INTERSECTION) => void ? INTERSECTION : never;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1 @@
export declare type IsNever<TYPE> = [TYPE] extends [never] ? true : false;

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,7 @@
import type { IsArray, IsObject } from "./extends";
export declare type DeepMergeUnsafe<TYPE_A, TYPE_B> = IsObject<TYPE_A> extends true ? IsObject<TYPE_B> extends true ? {
[KEY in keyof (TYPE_A & TYPE_B)]: KEY extends keyof TYPE_B ? KEY extends keyof TYPE_A ? DeepMergeUnsafe<TYPE_A[KEY], TYPE_B[KEY]> : TYPE_B[KEY] : KEY extends keyof TYPE_A ? TYPE_A[KEY] : never;
} : TYPE_B : IsArray<TYPE_A> extends true ? IsArray<TYPE_B> extends true ? TYPE_B extends unknown[] ? [
...(TYPE_A extends unknown[] ? TYPE_A : never),
TYPE_B
] : never : TYPE_B : TYPE_B;

1
frontend/node_modules/ts-algebra/lib/utils/merge.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

1
frontend/node_modules/ts-algebra/lib/utils/not.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare type Not<BOOL extends boolean> = BOOL extends false ? true : BOOL extends true ? false : never;

1
frontend/node_modules/ts-algebra/lib/utils/not.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

1
frontend/node_modules/ts-algebra/lib/utils/or.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare type Or<BOOL_A extends boolean, BOOL_B extends boolean> = BOOL_A extends true ? true : BOOL_B extends true ? true : false;

1
frontend/node_modules/ts-algebra/lib/utils/or.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,4 @@
import type { IsObject } from "./extends";
export declare type Prettify<TYPE> = IsObject<TYPE> extends true ? {
[KEY in keyof TYPE]: KEY extends keyof TYPE ? TYPE[KEY] : never;
} : TYPE;

View File

@@ -0,0 +1 @@
export {};

1
frontend/node_modules/ts-algebra/lib/utils/tail.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare type Tail<ARRAY extends unknown[]> = ARRAY extends readonly [] ? ARRAY : ARRAY extends readonly [unknown?, ...infer TAIL] ? TAIL : ARRAY;

1
frontend/node_modules/ts-algebra/lib/utils/tail.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,2 @@
import type { IntersectUnion } from "./intersectUnion";
export declare type UnionLast<UNION> = IntersectUnion<UNION extends unknown ? (x: UNION) => void : never> extends (x: infer LAST) => void ? LAST : never;

Some files were not shown because too many files have changed in this diff Show More