@xyo-network/payload-model
Advanced tools
Comparing version 3.6.0-rc.5 to 3.6.0-rc.6
@@ -14,10 +14,34 @@ import type { Hash } from '@xylabs/hex'; | ||
}>; | ||
export declare const isModuleError: (x?: unknown | null) => x is import("./Schema.ts").SchemaFields & import("./Payload.ts").PayloadFields & { | ||
details?: JsonValue; | ||
message?: string; | ||
name?: string; | ||
query?: Hash; | ||
schema: ModuleErrorSchema; | ||
sources?: Hash[]; | ||
}; | ||
export declare const isModuleError: (x?: unknown | null) => x is import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: "network.xyo.error.module"; | ||
details?: string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null; | ||
} | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null | undefined; | ||
message?: string | undefined; | ||
name?: string | undefined; | ||
query?: Hash | undefined; | ||
sources?: Lowercase<string>[] | undefined; | ||
}>; | ||
//# sourceMappingURL=Error.d.ts.map |
import type { Payload } from './Payload.ts'; | ||
export declare const isAnyPayload: (value: unknown) => value is Payload; | ||
export declare const asAnyPayload: { | ||
<TType extends { | ||
schema: string; | ||
} & import("./Payload.ts").PayloadFields>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends { | ||
schema: string; | ||
} & import("./Payload.ts").PayloadFields>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<{ | ||
schema: string; | ||
} & import("./Payload.ts").PayloadFields>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
<TType extends import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: import("./Schema.ts").Schema; | ||
}>>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: import("./Schema.ts").Schema; | ||
}>>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: import("./Schema.ts").Schema; | ||
}>>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
}; | ||
export declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T; | ||
export declare const asPayload: <T extends Payload>(schema: string[]) => { | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
}; | ||
//# sourceMappingURL=isPayload.d.ts.map |
import type { Hash } from '@xylabs/hex'; | ||
import type { EmptyObject } from '@xylabs/object'; | ||
import type { Schema, WithSchema } from './Schema.ts'; | ||
export interface SchemaField<T extends Schema = Schema> { | ||
schema: T; | ||
} | ||
/** Additional fields for a payload */ | ||
export interface PayloadFields extends EmptyObject { | ||
schema: Schema; | ||
export interface PayloadFields extends SchemaField { | ||
} | ||
export type WithPayload<T extends EmptyObject | void = void> = WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>; | ||
export type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>; | ||
/** Base Type for Payloads */ | ||
export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & { | ||
schema: S; | ||
} & PayloadFields> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & { | ||
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & { | ||
schema: S; | ||
} & PayloadFields> : WithPayload<T & { | ||
schema: Schema; | ||
} & PayloadFields> : /* Either just S or neither S or T provided */ { | ||
}> : WithPayload<T & PayloadFields> : WithPayload<{ | ||
schema: S extends Schema ? S : Schema; | ||
} & PayloadFields; | ||
export type OverridablePayload<T extends Payload> = Omit<T, 'schema'> & { | ||
schema: string; | ||
}; | ||
}>; | ||
export type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>; | ||
export type WithSources<T extends EmptyObject> = T & { | ||
@@ -26,5 +24,15 @@ sources?: Hash[]; | ||
export type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>; | ||
export type WithAnySchema<T extends Payload> = Omit<T, 'schema'> & { | ||
schema: string; | ||
export type WithAnySchema<T extends Payload> = OverridablePayload<T>; | ||
export type DeepOmitStartsWith<T, Prefix extends string> = T extends (infer U)[] ? DeepOmitStartsWith<U, Prefix>[] : T extends object ? { | ||
[K in keyof T as K extends string ? K extends `${Prefix}${string}` ? never : K : K]: DeepOmitStartsWith<T[K], Prefix>; | ||
} : T; | ||
export type DeepRestrictToStringKeys<T> = { | ||
[K in keyof T as K extends string ? K : never]: T[K] extends (infer U)[] ? DeepRestrictToStringKeys<U>[] : T[K] extends object ? DeepRestrictToStringKeys<T[K]> : T[K]; | ||
}; | ||
export type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'>; | ||
export type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'>; | ||
export type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'>; | ||
export type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>>; | ||
export type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'>; | ||
export type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField>; | ||
//# sourceMappingURL=Payload.d.ts.map |
@@ -15,3 +15,3 @@ import type { Address } from '@xylabs/hex'; | ||
} | ||
export type Query<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = Payload<T extends void ? QueryFields : T & QueryFields, S extends void ? T extends WithSchema ? T['schema'] : T extends void ? string : void : S>; | ||
export type Query<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = Payload<T extends void ? QueryFields : T & QueryFields, S extends void ? T extends WithSchema ? T['schema'] : T extends void ? Schema : void : S>; | ||
//# sourceMappingURL=Query.d.ts.map |
@@ -8,4 +8,4 @@ import type { EmptyObject } from '@xylabs/object'; | ||
export declare const asSchema: { | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
}; | ||
@@ -12,0 +12,0 @@ /** Schema fields for a Payload */ |
@@ -14,10 +14,34 @@ import type { Hash } from '@xylabs/hex'; | ||
}>; | ||
export declare const isModuleError: (x?: unknown | null) => x is import("./Schema.ts").SchemaFields & import("./Payload.ts").PayloadFields & { | ||
details?: JsonValue; | ||
message?: string; | ||
name?: string; | ||
query?: Hash; | ||
schema: ModuleErrorSchema; | ||
sources?: Hash[]; | ||
}; | ||
export declare const isModuleError: (x?: unknown | null) => x is import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: "network.xyo.error.module"; | ||
details?: string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null; | ||
} | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null | undefined; | ||
message?: string | undefined; | ||
name?: string | undefined; | ||
query?: Hash | undefined; | ||
sources?: Lowercase<string>[] | undefined; | ||
}>; | ||
//# sourceMappingURL=Error.d.ts.map |
import type { Payload } from './Payload.ts'; | ||
export declare const isAnyPayload: (value: unknown) => value is Payload; | ||
export declare const asAnyPayload: { | ||
<TType extends { | ||
schema: string; | ||
} & import("./Payload.ts").PayloadFields>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends { | ||
schema: string; | ||
} & import("./Payload.ts").PayloadFields>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<{ | ||
schema: string; | ||
} & import("./Payload.ts").PayloadFields>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
<TType extends import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: import("./Schema.ts").Schema; | ||
}>>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: import("./Schema.ts").Schema; | ||
}>>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: import("./Schema.ts").Schema; | ||
}>>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
}; | ||
export declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T; | ||
export declare const asPayload: <T extends Payload>(schema: string[]) => { | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
}; | ||
//# sourceMappingURL=isPayload.d.ts.map |
import type { Hash } from '@xylabs/hex'; | ||
import type { EmptyObject } from '@xylabs/object'; | ||
import type { Schema, WithSchema } from './Schema.ts'; | ||
export interface SchemaField<T extends Schema = Schema> { | ||
schema: T; | ||
} | ||
/** Additional fields for a payload */ | ||
export interface PayloadFields extends EmptyObject { | ||
schema: Schema; | ||
export interface PayloadFields extends SchemaField { | ||
} | ||
export type WithPayload<T extends EmptyObject | void = void> = WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>; | ||
export type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>; | ||
/** Base Type for Payloads */ | ||
export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & { | ||
schema: S; | ||
} & PayloadFields> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & { | ||
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & { | ||
schema: S; | ||
} & PayloadFields> : WithPayload<T & { | ||
schema: Schema; | ||
} & PayloadFields> : /* Either just S or neither S or T provided */ { | ||
}> : WithPayload<T & PayloadFields> : WithPayload<{ | ||
schema: S extends Schema ? S : Schema; | ||
} & PayloadFields; | ||
export type OverridablePayload<T extends Payload> = Omit<T, 'schema'> & { | ||
schema: string; | ||
}; | ||
}>; | ||
export type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>; | ||
export type WithSources<T extends EmptyObject> = T & { | ||
@@ -26,5 +24,15 @@ sources?: Hash[]; | ||
export type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>; | ||
export type WithAnySchema<T extends Payload> = Omit<T, 'schema'> & { | ||
schema: string; | ||
export type WithAnySchema<T extends Payload> = OverridablePayload<T>; | ||
export type DeepOmitStartsWith<T, Prefix extends string> = T extends (infer U)[] ? DeepOmitStartsWith<U, Prefix>[] : T extends object ? { | ||
[K in keyof T as K extends string ? K extends `${Prefix}${string}` ? never : K : K]: DeepOmitStartsWith<T[K], Prefix>; | ||
} : T; | ||
export type DeepRestrictToStringKeys<T> = { | ||
[K in keyof T as K extends string ? K : never]: T[K] extends (infer U)[] ? DeepRestrictToStringKeys<U>[] : T[K] extends object ? DeepRestrictToStringKeys<T[K]> : T[K]; | ||
}; | ||
export type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'>; | ||
export type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'>; | ||
export type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'>; | ||
export type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>>; | ||
export type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'>; | ||
export type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField>; | ||
//# sourceMappingURL=Payload.d.ts.map |
@@ -15,3 +15,3 @@ import type { Address } from '@xylabs/hex'; | ||
} | ||
export type Query<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = Payload<T extends void ? QueryFields : T & QueryFields, S extends void ? T extends WithSchema ? T['schema'] : T extends void ? string : void : S>; | ||
export type Query<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = Payload<T extends void ? QueryFields : T & QueryFields, S extends void ? T extends WithSchema ? T['schema'] : T extends void ? Schema : void : S>; | ||
//# sourceMappingURL=Query.d.ts.map |
@@ -8,4 +8,4 @@ import type { EmptyObject } from '@xylabs/object'; | ||
export declare const asSchema: { | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
}; | ||
@@ -12,0 +12,0 @@ /** Schema fields for a Payload */ |
@@ -14,10 +14,34 @@ import type { Hash } from '@xylabs/hex'; | ||
}>; | ||
export declare const isModuleError: (x?: unknown | null) => x is import("./Schema.ts").SchemaFields & import("./Payload.ts").PayloadFields & { | ||
details?: JsonValue; | ||
message?: string; | ||
name?: string; | ||
query?: Hash; | ||
schema: ModuleErrorSchema; | ||
sources?: Hash[]; | ||
}; | ||
export declare const isModuleError: (x?: unknown | null) => x is import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: "network.xyo.error.module"; | ||
details?: string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | (string | number | boolean | /*elided*/ any | /*elided*/ any | null)[] | null; | ||
} | (string | number | boolean | { | ||
[x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null; | ||
} | /*elided*/ any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null | undefined; | ||
message?: string | undefined; | ||
name?: string | undefined; | ||
query?: Hash | undefined; | ||
sources?: Lowercase<string>[] | undefined; | ||
}>; | ||
//# sourceMappingURL=Error.d.ts.map |
import type { Payload } from './Payload.ts'; | ||
export declare const isAnyPayload: (value: unknown) => value is Payload; | ||
export declare const asAnyPayload: { | ||
<TType extends { | ||
schema: string; | ||
} & import("./Payload.ts").PayloadFields>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends { | ||
schema: string; | ||
} & import("./Payload.ts").PayloadFields>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<{ | ||
schema: string; | ||
} & import("./Payload.ts").PayloadFields>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
<TType extends import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: import("./Schema.ts").Schema; | ||
}>>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: import("./Schema.ts").Schema; | ||
}>>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<import("./Payload.ts").DeepRestrictToStringKeys<{ | ||
schema: import("./Schema.ts").Schema; | ||
}>>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
}; | ||
export declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T; | ||
export declare const asPayload: <T extends Payload>(schema: string[]) => { | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
}; | ||
//# sourceMappingURL=isPayload.d.ts.map |
import type { Hash } from '@xylabs/hex'; | ||
import type { EmptyObject } from '@xylabs/object'; | ||
import type { Schema, WithSchema } from './Schema.ts'; | ||
export interface SchemaField<T extends Schema = Schema> { | ||
schema: T; | ||
} | ||
/** Additional fields for a payload */ | ||
export interface PayloadFields extends EmptyObject { | ||
schema: Schema; | ||
export interface PayloadFields extends SchemaField { | ||
} | ||
export type WithPayload<T extends EmptyObject | void = void> = WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>; | ||
export type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>; | ||
/** Base Type for Payloads */ | ||
export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & { | ||
schema: S; | ||
} & PayloadFields> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & { | ||
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & { | ||
schema: S; | ||
} & PayloadFields> : WithPayload<T & { | ||
schema: Schema; | ||
} & PayloadFields> : /* Either just S or neither S or T provided */ { | ||
}> : WithPayload<T & PayloadFields> : WithPayload<{ | ||
schema: S extends Schema ? S : Schema; | ||
} & PayloadFields; | ||
export type OverridablePayload<T extends Payload> = Omit<T, 'schema'> & { | ||
schema: string; | ||
}; | ||
}>; | ||
export type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>; | ||
export type WithSources<T extends EmptyObject> = T & { | ||
@@ -26,5 +24,15 @@ sources?: Hash[]; | ||
export type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>; | ||
export type WithAnySchema<T extends Payload> = Omit<T, 'schema'> & { | ||
schema: string; | ||
export type WithAnySchema<T extends Payload> = OverridablePayload<T>; | ||
export type DeepOmitStartsWith<T, Prefix extends string> = T extends (infer U)[] ? DeepOmitStartsWith<U, Prefix>[] : T extends object ? { | ||
[K in keyof T as K extends string ? K extends `${Prefix}${string}` ? never : K : K]: DeepOmitStartsWith<T[K], Prefix>; | ||
} : T; | ||
export type DeepRestrictToStringKeys<T> = { | ||
[K in keyof T as K extends string ? K : never]: T[K] extends (infer U)[] ? DeepRestrictToStringKeys<U>[] : T[K] extends object ? DeepRestrictToStringKeys<T[K]> : T[K]; | ||
}; | ||
export type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'>; | ||
export type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'>; | ||
export type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'>; | ||
export type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>>; | ||
export type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'>; | ||
export type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField>; | ||
//# sourceMappingURL=Payload.d.ts.map |
@@ -15,3 +15,3 @@ import type { Address } from '@xylabs/hex'; | ||
} | ||
export type Query<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = Payload<T extends void ? QueryFields : T & QueryFields, S extends void ? T extends WithSchema ? T['schema'] : T extends void ? string : void : S>; | ||
export type Query<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = Payload<T extends void ? QueryFields : T & QueryFields, S extends void ? T extends WithSchema ? T['schema'] : T extends void ? Schema : void : S>; | ||
//# sourceMappingURL=Query.d.ts.map |
@@ -8,4 +8,4 @@ import type { EmptyObject } from '@xylabs/object'; | ||
export declare const asSchema: { | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.14-a00a2a7e8e/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined; | ||
<TType extends string>(value: import(".store/@xylabs-promise-npm-4.4.15-6ab7463903/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig): TType; | ||
}; | ||
@@ -12,0 +12,0 @@ /** Schema fields for a Payload */ |
{ | ||
"name": "@xyo-network/payload-model", | ||
"version": "3.6.0-rc.5", | ||
"version": "3.6.0-rc.6", | ||
"description": "Primary SDK for using XYO Protocol 2.0", | ||
@@ -40,6 +40,6 @@ "homepage": "https://xyo.network", | ||
"dependencies": { | ||
"@xylabs/arraybuffer": "^4.4.14", | ||
"@xylabs/assert": "^4.4.14", | ||
"@xylabs/hex": "^4.4.14", | ||
"@xylabs/object": "^4.4.14" | ||
"@xylabs/arraybuffer": "^4.4.15", | ||
"@xylabs/assert": "^4.4.15", | ||
"@xylabs/hex": "^4.4.15", | ||
"@xylabs/object": "^4.4.15" | ||
}, | ||
@@ -49,3 +49,3 @@ "devDependencies": { | ||
"@xylabs/tsconfig": "^4.2.4", | ||
"@xylabs/vitest-extended": "^4.4.14", | ||
"@xylabs/vitest-extended": "^4.4.15", | ||
"typescript": "^5.7.2", | ||
@@ -52,0 +52,0 @@ "vitest": "^2.1.8" |
@@ -6,9 +6,12 @@ import type { Hash } from '@xylabs/hex' | ||
/** Additional fields for a payload */ | ||
export interface PayloadFields extends EmptyObject { | ||
schema: Schema | ||
export interface SchemaField<T extends Schema = Schema> { | ||
schema: T | ||
} | ||
export type WithPayload<T extends EmptyObject | void = void> = WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields> | ||
/** Additional fields for a payload */ | ||
export interface PayloadFields extends SchemaField {} | ||
export type WithPayload<T extends EmptyObject | void = void> = | ||
DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>> | ||
/** Base Type for Payloads */ | ||
@@ -19,3 +22,3 @@ export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = | ||
/* T (w/Schema) & S provided */ | ||
WithPayload<Omit<T, 'schema'> & { schema: S } & PayloadFields> | ||
WithPayload<Omit<T, 'schema'> & { schema: S }> | ||
: /* Only T (w/Schema) provided */ WithPayload<T> | ||
@@ -25,10 +28,10 @@ : T extends object ? | ||
/* T (w/o Schema) & S provided */ | ||
WithPayload<T & { schema: S } & PayloadFields> | ||
: /* Only T (w/o Schema) provided */ WithPayload<T & { schema: Schema } & PayloadFields> | ||
WithPayload<T & { schema: S }> | ||
: /* Only T (w/o Schema) provided */ WithPayload<T & PayloadFields> | ||
: /* Either just S or neither S or T provided */ | ||
{ | ||
schema: S extends Schema ? S : Schema | ||
} & PayloadFields | ||
WithPayload<{ | ||
schema: S extends Schema ? S : Schema | ||
}> | ||
export type OverridablePayload<T extends Payload> = Omit<T, 'schema'> & { schema: string } | ||
export type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields> | ||
@@ -38,2 +41,31 @@ export type WithSources<T extends EmptyObject> = T & { sources?: Hash[] } | ||
export type WithAnySchema<T extends Payload> = Omit<T, 'schema'> & { schema: string } | ||
export type WithAnySchema<T extends Payload> = OverridablePayload<T> | ||
export type DeepOmitStartsWith<T, Prefix extends string> = T extends (infer U)[] | ||
? DeepOmitStartsWith<U, Prefix>[] // Special handling for arrays | ||
: T extends object | ||
? { | ||
[K in keyof T as K extends string | ||
? K extends `${Prefix}${string}` | ||
? never | ||
: K | ||
: K]: DeepOmitStartsWith<T[K], Prefix>; | ||
} | ||
: T | ||
export type DeepRestrictToStringKeys<T> = { | ||
[K in keyof T as K extends string ? K : never]: T[K] extends (infer U)[] | ||
? DeepRestrictToStringKeys<U>[] // Handle arrays recursively | ||
: T[K] extends object | ||
? DeepRestrictToStringKeys<T[K]> // Handle objects recursively | ||
: T[K]; // Leave other types untouched | ||
} | ||
export type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'> | ||
export type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'> | ||
export type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'> | ||
export type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>> | ||
export type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'> | ||
export type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField> |
@@ -25,5 +25,5 @@ import type { Address } from '@xylabs/hex' | ||
T extends WithSchema ? T['schema'] | ||
: T extends void ? string | ||
: T extends void ? Schema | ||
: void | ||
: S | ||
> |
@@ -22,7 +22,7 @@ import type { Address, Hex } from '@xylabs/hex' | ||
export const isLocalSequence = (value: unknown): value is Sequence => { | ||
return isHex(value) && (value as string).length === (SequenceConstants.localSequenceBytes) * 2 | ||
return isHex(value) && (value as string).length === SequenceConstants.localSequenceBytes * 2 | ||
} | ||
export const isQualifiedSequence = (value: unknown): value is Sequence => { | ||
return isHex(value) && (value as string).length === (SequenceConstants.qualifiedSequenceBytes) * 2 | ||
return isHex(value) && (value as string).length === SequenceConstants.qualifiedSequenceBytes * 2 | ||
} | ||
@@ -41,8 +41,8 @@ | ||
export const SequenceComponentMinMax = { | ||
minEpoch: '0'.repeat(SequenceComponentLengths.epochBytes) as Epoch, | ||
maxEpoch: 'f'.repeat(SequenceComponentLengths.epochBytes) as Epoch, | ||
minNonce: '0'.repeat(SequenceComponentLengths.nonceBytes) as Nonce, | ||
maxNonce: 'f'.repeat(SequenceComponentLengths.nonceBytes) as Nonce, | ||
minAddress: '0'.repeat(SequenceComponentLengths.addressBytes) as Address, | ||
maxAddress: 'f'.repeat(SequenceComponentLengths.addressBytes) as Address, | ||
minEpoch: '0'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch, | ||
maxEpoch: 'f'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch, | ||
minNonce: '0'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce, | ||
maxNonce: 'f'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce, | ||
minAddress: '0'.repeat(SequenceComponentLengths.addressBytes * 2) as Address, | ||
maxAddress: 'f'.repeat(SequenceComponentLengths.addressBytes * 2) as Address, | ||
} | ||
@@ -49,0 +49,0 @@ |
@@ -122,4 +122,5 @@ import { toUint8Array } from '@xylabs/arraybuffer' | ||
} | ||
return toHex((hex as string).slice(-SequenceConstants.nonceBytes), { prefix: false, bitLength: SequenceConstants.nonceBytes * 8 }) as Nonce | ||
const hash = toHex((hex as string), { prefix: false, bitLength: SequenceConstants.nonceBytes * 8 }) | ||
return hash.slice(-SequenceConstants.nonceBytes * 2) as Nonce | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
210727
2112
Updated@xylabs/arraybuffer@^4.4.15
Updated@xylabs/assert@^4.4.15
Updated@xylabs/hex@^4.4.15
Updated@xylabs/object@^4.4.15