snapshot of https://github.com/tldraw/tldraw.git (main, 2026-09-23; blobs > 131072B omitted)
Some checks failed
Deploy analytics worker / Deploy analytics worker to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
i18n upload strings / Upload latest strings (push) Failing after 1s
Deploy bemo / Deploy bemo to ${{ (github.ref == 'refs/heads/bemo-production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
Deploy grafana resources / ${{ github.event_name == 'push' && 'Deploy grafana resources' || 'Validate grafana resources (dry run)' }} (push) Failing after 0s
End to end tests (dotcom) / Check for relevant changes (push) Failing after 0s
End to end tests (examples) / Check for relevant changes (push) Failing after 0s
End to end tests (mermaid readability) / Check for relevant changes (push) Failing after 1s
End to end tests (perf) / Check for relevant changes (push) Failing after 0s
Publish editor extensions / Publish editor extensions (push) Failing after 1s
Publish SDK packages / Remove the publish-packages label (push) Has been skipped
Checks / Tests & checks (push) Has been cancelled
Checks / Build all projects (push) Has been cancelled
Deploy templates / Deploy templates (push) Has been cancelled
End to end tests (dotcom) / End to end tests (dotcom) (push) Has been cancelled
End to end tests (mermaid readability) / End to end tests (mermaid readability) (push) Has been cancelled
End to end tests (perf) / End to end tests (perf) (push) Has been cancelled
Deploy .com / Deploy dotcom to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Has been cancelled
End to end tests (examples) / End to end tests (examples) (push) Has been cancelled
Publish SDK packages / Publish SDK packages (push) Has been cancelled
Publish SDK packages / Tell user released version (push) Has been cancelled
Publish SDK packages / Publishes code templates to separate repositories (push) Has been cancelled
Publish SDK packages / Deploys the template demos with the new SDK version (push) Has been cancelled
Some checks failed
Deploy analytics worker / Deploy analytics worker to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
i18n upload strings / Upload latest strings (push) Failing after 1s
Deploy bemo / Deploy bemo to ${{ (github.ref == 'refs/heads/bemo-production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
Deploy grafana resources / ${{ github.event_name == 'push' && 'Deploy grafana resources' || 'Validate grafana resources (dry run)' }} (push) Failing after 0s
End to end tests (dotcom) / Check for relevant changes (push) Failing after 0s
End to end tests (examples) / Check for relevant changes (push) Failing after 0s
End to end tests (mermaid readability) / Check for relevant changes (push) Failing after 1s
End to end tests (perf) / Check for relevant changes (push) Failing after 0s
Publish editor extensions / Publish editor extensions (push) Failing after 1s
Publish SDK packages / Remove the publish-packages label (push) Has been skipped
Checks / Tests & checks (push) Has been cancelled
Checks / Build all projects (push) Has been cancelled
Deploy templates / Deploy templates (push) Has been cancelled
End to end tests (dotcom) / End to end tests (dotcom) (push) Has been cancelled
End to end tests (mermaid readability) / End to end tests (mermaid readability) (push) Has been cancelled
End to end tests (perf) / End to end tests (perf) (push) Has been cancelled
Deploy .com / Deploy dotcom to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Has been cancelled
End to end tests (examples) / End to end tests (examples) (push) Has been cancelled
Publish SDK packages / Publish SDK packages (push) Has been cancelled
Publish SDK packages / Tell user released version (push) Has been cancelled
Publish SDK packages / Publishes code templates to separate repositories (push) Has been cancelled
Publish SDK packages / Deploys the template demos with the new SDK version (push) Has been cancelled
This commit is contained in:
260
packages/validate/api-report.api.md
Normal file
260
packages/validate/api-report.api.md
Normal file
@@ -0,0 +1,260 @@
|
||||
## API Report File for "@tldraw/validate"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
|
||||
import { IndexKey } from '@tldraw/utils';
|
||||
import { JsonValue } from '@tldraw/utils';
|
||||
import { MakeUndefinedOptional } from '@tldraw/utils';
|
||||
|
||||
// @public
|
||||
const any: Validator<any>;
|
||||
|
||||
// @public
|
||||
const array: Validator<unknown[]>;
|
||||
|
||||
// @public
|
||||
function arrayOf<T>(itemValidator: Validatable<T>): ArrayOfValidator<T>;
|
||||
|
||||
// @public
|
||||
export class ArrayOfValidator<T> extends Validator<T[]> {
|
||||
constructor(itemValidator: Validatable<T>);
|
||||
// (undocumented)
|
||||
readonly itemValidator: Validatable<T>;
|
||||
lengthGreaterThan1(): Validator<T[]>;
|
||||
nonEmpty(): Validator<T[]>;
|
||||
}
|
||||
|
||||
// @public
|
||||
const bigint: Validator<bigint>;
|
||||
|
||||
// @public
|
||||
const boolean: Validator<boolean>;
|
||||
|
||||
// @public
|
||||
function dict<Key extends string, Value>(keyValidator: Validatable<Key>, valueValidator: Validatable<Value>): DictValidator<Key, Value>;
|
||||
|
||||
// @public
|
||||
export class DictValidator<Key extends string, Value> extends Validator<Record<Key, Value>> {
|
||||
constructor(keyValidator: Validatable<Key>, valueValidator: Validatable<Value>);
|
||||
// (undocumented)
|
||||
readonly keyValidator: Validatable<Key>;
|
||||
// (undocumented)
|
||||
readonly valueValidator: Validatable<Value>;
|
||||
}
|
||||
|
||||
// @public
|
||||
const httpUrl: Validator<string>;
|
||||
|
||||
// @public
|
||||
const indexKey: Validator<IndexKey>;
|
||||
|
||||
// @public
|
||||
const integer: Validator<number>;
|
||||
|
||||
// @public
|
||||
function jsonDict(): DictValidator<string, JsonValue>;
|
||||
|
||||
// @public
|
||||
const jsonValue: Validator<JsonValue>;
|
||||
|
||||
// @public
|
||||
const linkUrl: Validator<string>;
|
||||
|
||||
// @public
|
||||
function literal<T extends boolean | number | string>(expectedValue: T): Validator<T>;
|
||||
|
||||
// @public
|
||||
function literalEnum<const Values extends readonly unknown[]>(...values: Values): Validator<Values[number]>;
|
||||
|
||||
// @public
|
||||
function model<T extends {
|
||||
readonly id: string;
|
||||
}>(name: string, validator: Validatable<T>): Validator<T>;
|
||||
|
||||
// @public
|
||||
const nonZeroFiniteNumber: Validator<number>;
|
||||
|
||||
// @public
|
||||
const nonZeroInteger: Validator<number>;
|
||||
|
||||
// @public
|
||||
const nonZeroNumber: Validator<number>;
|
||||
|
||||
// @public
|
||||
function nullable<T>(validator: Validatable<T>): Validator<null | T>;
|
||||
|
||||
// @public
|
||||
const number: Validator<number>;
|
||||
|
||||
// @internal
|
||||
function numberUnion<Key extends string, Config extends UnionValidatorConfig<Key, Config>>(key: Key, config: Config): UnionValidator<Key, Config>;
|
||||
|
||||
// @public
|
||||
function object<Shape extends object>(config: {
|
||||
readonly [K in keyof Shape]: Validatable<Shape[K]>;
|
||||
}): ObjectValidator<MakeUndefinedOptional<Shape>>;
|
||||
|
||||
// @public
|
||||
export class ObjectValidator<Shape extends object> extends Validator<Shape> {
|
||||
constructor(config: {
|
||||
readonly [K in keyof Shape]: Validatable<Shape[K]>;
|
||||
}, shouldAllowUnknownProperties?: boolean);
|
||||
allowUnknownProperties(): ObjectValidator<Shape>;
|
||||
// (undocumented)
|
||||
readonly config: {
|
||||
readonly [K in keyof Shape]: Validatable<Shape[K]>;
|
||||
};
|
||||
extend<Extension extends Record<string, unknown>>(extension: {
|
||||
readonly [K in keyof Extension]: Validatable<Extension[K]>;
|
||||
}): ObjectValidator<Shape & Extension>;
|
||||
}
|
||||
|
||||
// @public
|
||||
function optional<T>(validator: Validatable<T>): Validator<T | undefined>;
|
||||
|
||||
// @public
|
||||
function or<T1, T2>(v1: Validatable<T1>, v2: Validatable<T2>): Validator<T1 | T2>;
|
||||
|
||||
// @public
|
||||
const positiveInteger: Validator<number>;
|
||||
|
||||
// @public
|
||||
const positiveNumber: Validator<number>;
|
||||
|
||||
// @public
|
||||
function setEnum<T>(values: ReadonlySet<T>): Validator<T>;
|
||||
|
||||
// @public
|
||||
const srcUrl: Validator<string>;
|
||||
|
||||
// @public
|
||||
const string: Validator<string>;
|
||||
|
||||
declare namespace T {
|
||||
export {
|
||||
literal,
|
||||
arrayOf,
|
||||
object,
|
||||
jsonDict,
|
||||
dict,
|
||||
union,
|
||||
numberUnion,
|
||||
model,
|
||||
setEnum,
|
||||
optional,
|
||||
nullable,
|
||||
literalEnum,
|
||||
or,
|
||||
ValidatorFn,
|
||||
ValidatorUsingKnownGoodVersionFn,
|
||||
Validatable,
|
||||
ValidationError,
|
||||
TypeOf,
|
||||
Validator,
|
||||
ArrayOfValidator,
|
||||
ObjectValidator,
|
||||
UnionValidatorConfig,
|
||||
UnionValidator,
|
||||
DictValidator,
|
||||
unknown,
|
||||
any,
|
||||
string,
|
||||
number,
|
||||
positiveNumber,
|
||||
nonZeroNumber,
|
||||
nonZeroFiniteNumber,
|
||||
unitInterval,
|
||||
integer,
|
||||
positiveInteger,
|
||||
nonZeroInteger,
|
||||
boolean,
|
||||
bigint,
|
||||
array,
|
||||
unknownObject,
|
||||
jsonValue,
|
||||
linkUrl,
|
||||
srcUrl,
|
||||
httpUrl,
|
||||
indexKey
|
||||
}
|
||||
}
|
||||
export { T }
|
||||
|
||||
// @public
|
||||
type TypeOf<V extends Validatable<any>> = V extends Validatable<infer T> ? T : never;
|
||||
|
||||
// @public
|
||||
function union<Key extends string, Config extends UnionValidatorConfig<Key, Config>>(key: Key, config: Config): UnionValidator<Key, Config>;
|
||||
|
||||
// @public
|
||||
export class UnionValidator<Key extends string, Config extends UnionValidatorConfig<Key, Config>, UnknownValue = never> extends Validator<TypeOf<Config[keyof Config]> | UnknownValue> {
|
||||
constructor(key: Key, config: Config, unknownValueValidation: (value: object, variant: string) => UnknownValue, useNumberKeys: boolean);
|
||||
validateUnknownVariants<Unknown>(unknownValueValidation: (value: object, variant: string) => Unknown): UnionValidator<Key, Config, Unknown>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type UnionValidatorConfig<Key extends string, Config> = {
|
||||
readonly [Variant in keyof Config]: Validatable<any> & {
|
||||
validate(input: any): {
|
||||
readonly [K in Key]: Variant;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// @public
|
||||
const unitInterval: Validator<number>;
|
||||
|
||||
// @public
|
||||
const unknown: Validator<unknown>;
|
||||
|
||||
// @public
|
||||
const unknownObject: Validator<Record<string, unknown>>;
|
||||
|
||||
// @public
|
||||
interface Validatable<T> {
|
||||
validate(value: unknown): T;
|
||||
validateUsingKnownGoodVersion?(knownGoodValue: T, newValue: unknown): T;
|
||||
}
|
||||
|
||||
// @public
|
||||
class ValidationError extends Error {
|
||||
constructor(rawMessage: string, path?: ReadonlyArray<number | string>);
|
||||
// (undocumented)
|
||||
name: string;
|
||||
// (undocumented)
|
||||
readonly path: ReadonlyArray<number | string>;
|
||||
// (undocumented)
|
||||
readonly rawMessage: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class Validator<T> implements Validatable<T> {
|
||||
constructor(validationFn: ValidatorFn<T>, validateUsingKnownGoodVersionFn?: undefined | ValidatorUsingKnownGoodVersionFn<T>,
|
||||
skipSameValueCheck?: boolean);
|
||||
check(name: string, checkFn: (value: T) => void): Validator<T>;
|
||||
check(checkFn: (value: T) => void): Validator<T>;
|
||||
isValid(value: unknown): value is T;
|
||||
nullable(): Validator<null | T>;
|
||||
optional(): Validator<T | undefined>;
|
||||
refine<U>(otherValidationFn: (value: T) => U): Validator<U>;
|
||||
// @internal (undocumented)
|
||||
readonly skipSameValueCheck: boolean;
|
||||
validate(value: unknown): T;
|
||||
validateUsingKnownGoodVersion(knownGoodValue: T, newValue: unknown): T;
|
||||
// (undocumented)
|
||||
readonly validateUsingKnownGoodVersionFn?: undefined | ValidatorUsingKnownGoodVersionFn<T>;
|
||||
// (undocumented)
|
||||
readonly validationFn: ValidatorFn<T>;
|
||||
}
|
||||
|
||||
// @public
|
||||
type ValidatorFn<T> = (value: unknown) => T;
|
||||
|
||||
// @public
|
||||
type ValidatorUsingKnownGoodVersionFn<In, Out = In> = (knownGoodValue: In, value: unknown) => Out;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user