New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@xyo-network/payload-model

Package Overview
Dependencies
Maintainers
5
Versions
769
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xyo-network/payload-model - npm Package Compare versions

Comparing version 3.8.0 to 3.8.1

310

dist/browser/index.d.ts

@@ -1,13 +0,297 @@

export * from './Error.ts';
export * from './isPayload.ts';
export * from './isPayloadOfSchemaType.ts';
export * from './Payload.ts';
export * from './PayloadFindFilter.ts';
export * from './PayloadSet/index.ts';
export * from './PayloadValidationFunction.ts';
export * from './PayloadValueExpression.ts';
export * from './Query.ts';
export * from './Schema.ts';
export * from './StorageMeta/index.ts';
export * from './Timestamp.ts';
//# sourceMappingURL=index.d.ts.map
import * as _xylabs_object from '@xylabs/object';
import { EmptyObject, DeepRestrictToStringKeys, DeepOmitStartsWith, DeepPickStartsWith, JsonObject, JsonValue, Compare } from '@xylabs/object';
import { Hash, Address, Hex } from '@xylabs/hex';
import * as _store__xylabs_promise_npm_4_5_1_97d36b712b_package from '.store/@xylabs-promise-npm-4.5.1-97d36b712b/package';
type Schema = string;
declare const PayloadSchema: "network.xyo.payload";
type PayloadSchema = typeof PayloadSchema;
declare const isSchema: (value: unknown) => value is Schema;
declare const asSchema: {
<TType extends string>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends string>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<string>, config?: _xylabs_object.TypeCheckConfig): TType;
};
interface SchemaFields extends EmptyObject {
schema: Schema;
}
type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields;
interface SchemaField<T extends Schema = Schema> {
schema: T;
}
interface PayloadFields extends SchemaField {
}
type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>;
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;
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
schema: S;
}> : WithPayload<T & PayloadFields> : WithPayload<{
schema: S extends Schema ? S : Schema;
}>;
type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>;
type SourcesMetaField = {
$sources: Hash[];
};
type WithSources<T extends EmptyObject> = T & SourcesMetaField;
type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T;
type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
type PayloadWithOptionalSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithOptionalSources<Payload<T, S>>;
type WithAnySchema<T extends Payload> = OverridablePayload<T>;
type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'>;
type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'>;
type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'>;
type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>>;
type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'>;
type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField>;
type WithOnlyClientMeta<T extends EmptyObject> = DeepPickStartsWith<T, '$'>;
type AnyPayload = Payload<JsonObject, Schema>;
declare const ModuleErrorSchema: "network.xyo.error.module";
type ModuleErrorSchema = typeof ModuleErrorSchema;
type ModuleError = Payload<{
details?: JsonValue;
message?: string;
name?: string;
query?: Hash;
schema: ModuleErrorSchema;
}>;
declare const isModuleError: (x?: unknown | null) => x is _xylabs_object.DeepRestrictToStringKeys<{
schema: "network.xyo.error.module";
details?: string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | any | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | any | null;
} | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null | undefined;
message?: string | undefined;
name?: string | undefined;
query?: Hash | undefined;
}>;
declare const isAnyPayload: (value: unknown) => value is Payload;
declare const asAnyPayload: {
<TType extends _xylabs_object.DeepRestrictToStringKeys<{
schema: Schema;
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends _xylabs_object.DeepRestrictToStringKeys<{
schema: Schema;
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<_xylabs_object.DeepRestrictToStringKeys<{
schema: Schema;
}>>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T;
declare const asPayload: <T extends Payload>(schema: string[]) => {
<TType extends T>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends T>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<T>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']): (x?: unknown | null) => x is T;
declare const isPayloadOfSchemaTypeWithSources: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is WithSources<T>;
declare const notPayloadOfSchemaType: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is T;
interface PayloadFindFilter {
limit?: number;
order?: 'desc' | 'asc';
schema?: string | string[];
}
declare const PayloadSetSchema: "network.xyo.payload.set";
type PayloadSetSchema = typeof PayloadSetSchema;
interface PayloadSet {
optional?: Record<string, number>;
required?: Record<string, number>;
}
type PayloadSetPayload = Payload<PayloadSet, PayloadSetSchema>;
type SyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => boolean;
type AsyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => Promise<boolean>;
type PayloadValidationFunction<T extends Payload = Payload> = SyncPayloadValidationFunction<T> | AsyncPayloadValidationFunction<T>;
type PayloadProperty<T extends Payload = Payload> = keyof T;
type PayloadValue<T extends Payload = Payload, Key extends PayloadProperty<T> = PayloadProperty<T>> = T[Key];
type PayloadValueExpression<T extends Payload = Payload, Key extends PayloadProperty<T> = PayloadProperty<T>, TValue = PayloadValue<T, Key>> = (payload: T) => TValue;
interface QueryFields {
address?: Address | Address[];
budget?: number;
maxFrequency?: 'once' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
minBid?: number;
}
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>;
interface DataHashStorageMeta {
_dataHash: Hash;
}
type WithDataHashStorageMeta<T extends Payload = Payload> = T & DataHashStorageMeta;
type WithPartialDataHashStorageMeta<T extends Payload = Payload> = Partial<WithDataHashStorageMeta<T>>;
declare const isDataHashStorageMeta: (value: unknown) => value is DataHashStorageMeta;
declare const asDataHashStorageMeta: {
<TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<DataHashStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalDataHashStorageMeta: <TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
interface HashStorageMeta extends DataHashStorageMeta {
_hash: Hash;
}
type WithHashStorageMeta<T extends Payload = Payload> = T & HashStorageMeta;
type WithPartialHashStorageMeta<T extends Payload = Payload> = Partial<WithHashStorageMeta<T>>;
declare const isHashStorageMeta: (value: unknown) => value is HashStorageMeta;
declare const asHashStorageMeta: {
<TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<HashStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalHashStorageMeta: <TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
declare const SequenceComparer: {
local: Compare<Lowercase<string>>;
qualified: Compare<Lowercase<string>>;
};
type LocalSequence = Hex & Exclude<string, 'reserved-local-sequence-value'>;
type QualifiedSequence = Hex & Exclude<string, 'reserved-qualified-sequence-value'>;
type Sequence = LocalSequence | QualifiedSequence;
type Epoch = Hex & Exclude<string, 'reserved-epoch-sequence-value'>;
declare const isEpoch: (value: unknown) => value is Epoch;
type Nonce = Hex & Exclude<string, 'reserved-nonce-sequence-value'>;
declare const isNonce: (value: unknown) => value is Epoch;
declare const isLocalSequence: (value: unknown) => value is Sequence;
declare const isQualifiedSequence: (value: unknown) => value is Sequence;
declare const isSequence: (value: unknown) => value is Sequence;
declare const SequenceNonceComponentLengths: {
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare const SequenceComponentLengths: {
epochBytes: number;
nonceBytes: number;
addressBytes: number;
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare const SequenceComponentMinMax: {
minEpoch: Epoch;
maxEpoch: Epoch;
minNonce: Nonce;
maxNonce: Nonce;
minAddress: Address;
maxAddress: Address;
};
declare const LocalSequenceConstants: {
localSequenceBytes: number;
minLocalSequence: LocalSequence;
maxLocalSequence: LocalSequence;
minEpoch: Epoch;
maxEpoch: Epoch;
minNonce: Nonce;
maxNonce: Nonce;
minAddress: Address;
maxAddress: Address;
epochBytes: number;
nonceBytes: number;
addressBytes: number;
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare const QualifiedSequenceConstants: {
qualifiedSequenceBytes: number;
minQualifiedSequence: QualifiedSequence;
maxQualifiedSequence: QualifiedSequence;
};
declare const SequenceConstants: {
qualifiedSequenceBytes: number;
minQualifiedSequence: QualifiedSequence;
maxQualifiedSequence: QualifiedSequence;
localSequenceBytes: number;
minLocalSequence: LocalSequence;
maxLocalSequence: LocalSequence;
minEpoch: Epoch;
maxEpoch: Epoch;
minNonce: Nonce;
maxNonce: Nonce;
minAddress: Address;
maxAddress: Address;
epochBytes: number;
nonceBytes: number;
addressBytes: number;
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare class SequenceParser {
protected static privateConstructorKey: string;
private readonly data;
protected constructor(privateConstructorKey: string, hex: Hex);
get address(): Address;
get epoch(): Epoch;
get localSequence(): LocalSequence;
get nonce(): Nonce;
get qualifiedSequence(): QualifiedSequence;
static from(sequence: Sequence, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hash, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hex, address?: Address): SequenceParser;
static from(timestamp: Hex, nonce: Nonce, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hash, index?: number, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hex, index?: number, address?: Address): SequenceParser;
static from(timestamp: Hex, nonce: Nonce, index?: number, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hash, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hex, address?: Address): SequenceParser;
static from(timestamp: number, nonce: Nonce, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hash, index?: number, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hex, index?: number, address?: Address): SequenceParser;
static from(timestamp: number, nonce: Nonce, index?: number, address?: Address): SequenceParser;
static parse(value: Hex | string | ArrayBufferLike): SequenceParser;
static toEpoch(value: number | Hex | Epoch): Epoch;
static toNonce(value: Hash | Hex, index?: number): Nonce;
}
interface SequenceStorageMeta {
_sequence: Sequence;
}
type WithSequenceStorageMeta<T extends Payload = Payload> = T & SequenceStorageMeta;
type WithPartialSequenceStorageMeta<T extends Payload = Payload> = Partial<WithSequenceStorageMeta<T>>;
declare const isSequenceStorageMeta: (value: unknown) => value is SequenceStorageMeta;
declare const asSequenceStorageMeta: {
<TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<SequenceStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalSequenceStorageMeta: <TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
interface StorageMeta extends SequenceStorageMeta, HashStorageMeta {
}
type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta;
type WithPartialStorageMeta<T extends Payload = Payload> = T & Partial<StorageMeta>;
declare const isStorageMeta: (value: unknown) => value is StorageMeta;
declare const asStorageStorageMeta: {
<TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<StorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalStorageMeta: <TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
interface Timestamp {
timestamp: number;
}
type WithTimestamp<T extends EmptyObject = EmptyObject> = T & Timestamp;
export { type AnyPayload, type AsyncPayloadValidationFunction, type DataHashStorageMeta, type Epoch, type HashStorageMeta, type LocalSequence, LocalSequenceConstants, type ModuleError, ModuleErrorSchema, type Nonce, type OverridablePayload, type Payload, type PayloadFields, type PayloadFindFilter, type PayloadProperty, PayloadSchema, type PayloadSet, type PayloadSetPayload, PayloadSetSchema, type PayloadValidationFunction, type PayloadValue, type PayloadValueExpression, type PayloadWithOptionalSources, type PayloadWithSources, type QualifiedSequence, QualifiedSequenceConstants, type Query, type QueryFields, type Schema, type SchemaField, type SchemaFields, type Sequence, SequenceComparer, SequenceComponentLengths, SequenceComponentMinMax, SequenceConstants, SequenceNonceComponentLengths, SequenceParser, type SequenceStorageMeta, type SourcesMetaField, type StorageMeta, type SyncPayloadValidationFunction, type Timestamp, type WithAnySchema, type WithDataHashStorageMeta, type WithHashStorageMeta, type WithOnlyClientMeta, type WithOptionalSchema, type WithOptionalSources, type WithPartialDataHashStorageMeta, type WithPartialHashStorageMeta, type WithPartialSequenceStorageMeta, type WithPartialStorageMeta, type WithPayload, type WithSchema, type WithSequenceStorageMeta, type WithSources, type WithStorageMeta, type WithTimestamp, type WithoutClientMeta, type WithoutMeta, type WithoutPrivateStorageMeta, type WithoutSchema, type WithoutStorageMeta, asAnyPayload, asDataHashStorageMeta, asHashStorageMeta, asOptionalDataHashStorageMeta, asOptionalHashStorageMeta, asOptionalSequenceStorageMeta, asOptionalStorageMeta, asPayload, asSchema, asSequenceStorageMeta, asStorageStorageMeta, isAnyPayload, isDataHashStorageMeta, isEpoch, isHashStorageMeta, isLocalSequence, isModuleError, isNonce, isPayload, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, isQualifiedSequence, isSchema, isSequence, isSequenceStorageMeta, isStorageMeta, notPayloadOfSchemaType };

@@ -1,13 +0,297 @@

export * from './Error.ts';
export * from './isPayload.ts';
export * from './isPayloadOfSchemaType.ts';
export * from './Payload.ts';
export * from './PayloadFindFilter.ts';
export * from './PayloadSet/index.ts';
export * from './PayloadValidationFunction.ts';
export * from './PayloadValueExpression.ts';
export * from './Query.ts';
export * from './Schema.ts';
export * from './StorageMeta/index.ts';
export * from './Timestamp.ts';
//# sourceMappingURL=index.d.ts.map
import * as _xylabs_object from '@xylabs/object';
import { EmptyObject, DeepRestrictToStringKeys, DeepOmitStartsWith, DeepPickStartsWith, JsonObject, JsonValue, Compare } from '@xylabs/object';
import { Hash, Address, Hex } from '@xylabs/hex';
import * as _store__xylabs_promise_npm_4_5_1_97d36b712b_package from '.store/@xylabs-promise-npm-4.5.1-97d36b712b/package';
type Schema = string;
declare const PayloadSchema: "network.xyo.payload";
type PayloadSchema = typeof PayloadSchema;
declare const isSchema: (value: unknown) => value is Schema;
declare const asSchema: {
<TType extends string>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends string>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<string>, config?: _xylabs_object.TypeCheckConfig): TType;
};
interface SchemaFields extends EmptyObject {
schema: Schema;
}
type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields;
interface SchemaField<T extends Schema = Schema> {
schema: T;
}
interface PayloadFields extends SchemaField {
}
type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>;
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;
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
schema: S;
}> : WithPayload<T & PayloadFields> : WithPayload<{
schema: S extends Schema ? S : Schema;
}>;
type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>;
type SourcesMetaField = {
$sources: Hash[];
};
type WithSources<T extends EmptyObject> = T & SourcesMetaField;
type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T;
type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
type PayloadWithOptionalSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithOptionalSources<Payload<T, S>>;
type WithAnySchema<T extends Payload> = OverridablePayload<T>;
type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'>;
type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'>;
type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'>;
type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>>;
type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'>;
type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField>;
type WithOnlyClientMeta<T extends EmptyObject> = DeepPickStartsWith<T, '$'>;
type AnyPayload = Payload<JsonObject, Schema>;
declare const ModuleErrorSchema: "network.xyo.error.module";
type ModuleErrorSchema = typeof ModuleErrorSchema;
type ModuleError = Payload<{
details?: JsonValue;
message?: string;
name?: string;
query?: Hash;
schema: ModuleErrorSchema;
}>;
declare const isModuleError: (x?: unknown | null) => x is _xylabs_object.DeepRestrictToStringKeys<{
schema: "network.xyo.error.module";
details?: string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | any | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | any | null;
} | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null | undefined;
message?: string | undefined;
name?: string | undefined;
query?: Hash | undefined;
}>;
declare const isAnyPayload: (value: unknown) => value is Payload;
declare const asAnyPayload: {
<TType extends _xylabs_object.DeepRestrictToStringKeys<{
schema: Schema;
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends _xylabs_object.DeepRestrictToStringKeys<{
schema: Schema;
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<_xylabs_object.DeepRestrictToStringKeys<{
schema: Schema;
}>>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T;
declare const asPayload: <T extends Payload>(schema: string[]) => {
<TType extends T>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends T>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<T>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']): (x?: unknown | null) => x is T;
declare const isPayloadOfSchemaTypeWithSources: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is WithSources<T>;
declare const notPayloadOfSchemaType: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is T;
interface PayloadFindFilter {
limit?: number;
order?: 'desc' | 'asc';
schema?: string | string[];
}
declare const PayloadSetSchema: "network.xyo.payload.set";
type PayloadSetSchema = typeof PayloadSetSchema;
interface PayloadSet {
optional?: Record<string, number>;
required?: Record<string, number>;
}
type PayloadSetPayload = Payload<PayloadSet, PayloadSetSchema>;
type SyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => boolean;
type AsyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => Promise<boolean>;
type PayloadValidationFunction<T extends Payload = Payload> = SyncPayloadValidationFunction<T> | AsyncPayloadValidationFunction<T>;
type PayloadProperty<T extends Payload = Payload> = keyof T;
type PayloadValue<T extends Payload = Payload, Key extends PayloadProperty<T> = PayloadProperty<T>> = T[Key];
type PayloadValueExpression<T extends Payload = Payload, Key extends PayloadProperty<T> = PayloadProperty<T>, TValue = PayloadValue<T, Key>> = (payload: T) => TValue;
interface QueryFields {
address?: Address | Address[];
budget?: number;
maxFrequency?: 'once' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
minBid?: number;
}
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>;
interface DataHashStorageMeta {
_dataHash: Hash;
}
type WithDataHashStorageMeta<T extends Payload = Payload> = T & DataHashStorageMeta;
type WithPartialDataHashStorageMeta<T extends Payload = Payload> = Partial<WithDataHashStorageMeta<T>>;
declare const isDataHashStorageMeta: (value: unknown) => value is DataHashStorageMeta;
declare const asDataHashStorageMeta: {
<TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<DataHashStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalDataHashStorageMeta: <TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
interface HashStorageMeta extends DataHashStorageMeta {
_hash: Hash;
}
type WithHashStorageMeta<T extends Payload = Payload> = T & HashStorageMeta;
type WithPartialHashStorageMeta<T extends Payload = Payload> = Partial<WithHashStorageMeta<T>>;
declare const isHashStorageMeta: (value: unknown) => value is HashStorageMeta;
declare const asHashStorageMeta: {
<TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<HashStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalHashStorageMeta: <TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
declare const SequenceComparer: {
local: Compare<Lowercase<string>>;
qualified: Compare<Lowercase<string>>;
};
type LocalSequence = Hex & Exclude<string, 'reserved-local-sequence-value'>;
type QualifiedSequence = Hex & Exclude<string, 'reserved-qualified-sequence-value'>;
type Sequence = LocalSequence | QualifiedSequence;
type Epoch = Hex & Exclude<string, 'reserved-epoch-sequence-value'>;
declare const isEpoch: (value: unknown) => value is Epoch;
type Nonce = Hex & Exclude<string, 'reserved-nonce-sequence-value'>;
declare const isNonce: (value: unknown) => value is Epoch;
declare const isLocalSequence: (value: unknown) => value is Sequence;
declare const isQualifiedSequence: (value: unknown) => value is Sequence;
declare const isSequence: (value: unknown) => value is Sequence;
declare const SequenceNonceComponentLengths: {
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare const SequenceComponentLengths: {
epochBytes: number;
nonceBytes: number;
addressBytes: number;
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare const SequenceComponentMinMax: {
minEpoch: Epoch;
maxEpoch: Epoch;
minNonce: Nonce;
maxNonce: Nonce;
minAddress: Address;
maxAddress: Address;
};
declare const LocalSequenceConstants: {
localSequenceBytes: number;
minLocalSequence: LocalSequence;
maxLocalSequence: LocalSequence;
minEpoch: Epoch;
maxEpoch: Epoch;
minNonce: Nonce;
maxNonce: Nonce;
minAddress: Address;
maxAddress: Address;
epochBytes: number;
nonceBytes: number;
addressBytes: number;
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare const QualifiedSequenceConstants: {
qualifiedSequenceBytes: number;
minQualifiedSequence: QualifiedSequence;
maxQualifiedSequence: QualifiedSequence;
};
declare const SequenceConstants: {
qualifiedSequenceBytes: number;
minQualifiedSequence: QualifiedSequence;
maxQualifiedSequence: QualifiedSequence;
localSequenceBytes: number;
minLocalSequence: LocalSequence;
maxLocalSequence: LocalSequence;
minEpoch: Epoch;
maxEpoch: Epoch;
minNonce: Nonce;
maxNonce: Nonce;
minAddress: Address;
maxAddress: Address;
epochBytes: number;
nonceBytes: number;
addressBytes: number;
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare class SequenceParser {
protected static privateConstructorKey: string;
private readonly data;
protected constructor(privateConstructorKey: string, hex: Hex);
get address(): Address;
get epoch(): Epoch;
get localSequence(): LocalSequence;
get nonce(): Nonce;
get qualifiedSequence(): QualifiedSequence;
static from(sequence: Sequence, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hash, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hex, address?: Address): SequenceParser;
static from(timestamp: Hex, nonce: Nonce, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hash, index?: number, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hex, index?: number, address?: Address): SequenceParser;
static from(timestamp: Hex, nonce: Nonce, index?: number, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hash, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hex, address?: Address): SequenceParser;
static from(timestamp: number, nonce: Nonce, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hash, index?: number, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hex, index?: number, address?: Address): SequenceParser;
static from(timestamp: number, nonce: Nonce, index?: number, address?: Address): SequenceParser;
static parse(value: Hex | string | ArrayBufferLike): SequenceParser;
static toEpoch(value: number | Hex | Epoch): Epoch;
static toNonce(value: Hash | Hex, index?: number): Nonce;
}
interface SequenceStorageMeta {
_sequence: Sequence;
}
type WithSequenceStorageMeta<T extends Payload = Payload> = T & SequenceStorageMeta;
type WithPartialSequenceStorageMeta<T extends Payload = Payload> = Partial<WithSequenceStorageMeta<T>>;
declare const isSequenceStorageMeta: (value: unknown) => value is SequenceStorageMeta;
declare const asSequenceStorageMeta: {
<TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<SequenceStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalSequenceStorageMeta: <TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
interface StorageMeta extends SequenceStorageMeta, HashStorageMeta {
}
type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta;
type WithPartialStorageMeta<T extends Payload = Payload> = T & Partial<StorageMeta>;
declare const isStorageMeta: (value: unknown) => value is StorageMeta;
declare const asStorageStorageMeta: {
<TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<StorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalStorageMeta: <TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
interface Timestamp {
timestamp: number;
}
type WithTimestamp<T extends EmptyObject = EmptyObject> = T & Timestamp;
export { type AnyPayload, type AsyncPayloadValidationFunction, type DataHashStorageMeta, type Epoch, type HashStorageMeta, type LocalSequence, LocalSequenceConstants, type ModuleError, ModuleErrorSchema, type Nonce, type OverridablePayload, type Payload, type PayloadFields, type PayloadFindFilter, type PayloadProperty, PayloadSchema, type PayloadSet, type PayloadSetPayload, PayloadSetSchema, type PayloadValidationFunction, type PayloadValue, type PayloadValueExpression, type PayloadWithOptionalSources, type PayloadWithSources, type QualifiedSequence, QualifiedSequenceConstants, type Query, type QueryFields, type Schema, type SchemaField, type SchemaFields, type Sequence, SequenceComparer, SequenceComponentLengths, SequenceComponentMinMax, SequenceConstants, SequenceNonceComponentLengths, SequenceParser, type SequenceStorageMeta, type SourcesMetaField, type StorageMeta, type SyncPayloadValidationFunction, type Timestamp, type WithAnySchema, type WithDataHashStorageMeta, type WithHashStorageMeta, type WithOnlyClientMeta, type WithOptionalSchema, type WithOptionalSources, type WithPartialDataHashStorageMeta, type WithPartialHashStorageMeta, type WithPartialSequenceStorageMeta, type WithPartialStorageMeta, type WithPayload, type WithSchema, type WithSequenceStorageMeta, type WithSources, type WithStorageMeta, type WithTimestamp, type WithoutClientMeta, type WithoutMeta, type WithoutPrivateStorageMeta, type WithoutSchema, type WithoutStorageMeta, asAnyPayload, asDataHashStorageMeta, asHashStorageMeta, asOptionalDataHashStorageMeta, asOptionalHashStorageMeta, asOptionalSequenceStorageMeta, asOptionalStorageMeta, asPayload, asSchema, asSequenceStorageMeta, asStorageStorageMeta, isAnyPayload, isDataHashStorageMeta, isEpoch, isHashStorageMeta, isLocalSequence, isModuleError, isNonce, isPayload, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, isQualifiedSequence, isSchema, isSequence, isSequenceStorageMeta, isStorageMeta, notPayloadOfSchemaType };

@@ -1,13 +0,297 @@

export * from './Error.ts';
export * from './isPayload.ts';
export * from './isPayloadOfSchemaType.ts';
export * from './Payload.ts';
export * from './PayloadFindFilter.ts';
export * from './PayloadSet/index.ts';
export * from './PayloadValidationFunction.ts';
export * from './PayloadValueExpression.ts';
export * from './Query.ts';
export * from './Schema.ts';
export * from './StorageMeta/index.ts';
export * from './Timestamp.ts';
//# sourceMappingURL=index.d.ts.map
import * as _xylabs_object from '@xylabs/object';
import { EmptyObject, DeepRestrictToStringKeys, DeepOmitStartsWith, DeepPickStartsWith, JsonObject, JsonValue, Compare } from '@xylabs/object';
import { Hash, Address, Hex } from '@xylabs/hex';
import * as _store__xylabs_promise_npm_4_5_1_97d36b712b_package from '.store/@xylabs-promise-npm-4.5.1-97d36b712b/package';
type Schema = string;
declare const PayloadSchema: "network.xyo.payload";
type PayloadSchema = typeof PayloadSchema;
declare const isSchema: (value: unknown) => value is Schema;
declare const asSchema: {
<TType extends string>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends string>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<string>, config?: _xylabs_object.TypeCheckConfig): TType;
};
interface SchemaFields extends EmptyObject {
schema: Schema;
}
type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields;
interface SchemaField<T extends Schema = Schema> {
schema: T;
}
interface PayloadFields extends SchemaField {
}
type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>;
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;
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
schema: S;
}> : WithPayload<T & PayloadFields> : WithPayload<{
schema: S extends Schema ? S : Schema;
}>;
type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>;
type SourcesMetaField = {
$sources: Hash[];
};
type WithSources<T extends EmptyObject> = T & SourcesMetaField;
type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T;
type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
type PayloadWithOptionalSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithOptionalSources<Payload<T, S>>;
type WithAnySchema<T extends Payload> = OverridablePayload<T>;
type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'>;
type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'>;
type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'>;
type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>>;
type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'>;
type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField>;
type WithOnlyClientMeta<T extends EmptyObject> = DeepPickStartsWith<T, '$'>;
type AnyPayload = Payload<JsonObject, Schema>;
declare const ModuleErrorSchema: "network.xyo.error.module";
type ModuleErrorSchema = typeof ModuleErrorSchema;
type ModuleError = Payload<{
details?: JsonValue;
message?: string;
name?: string;
query?: Hash;
schema: ModuleErrorSchema;
}>;
declare const isModuleError: (x?: unknown | null) => x is _xylabs_object.DeepRestrictToStringKeys<{
schema: "network.xyo.error.module";
details?: string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | (string | number | boolean | any | any | null)[] | null;
} | (string | number | boolean | {
[x: string]: string | number | boolean | any | any | null;
} | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null | undefined;
message?: string | undefined;
name?: string | undefined;
query?: Hash | undefined;
}>;
declare const isAnyPayload: (value: unknown) => value is Payload;
declare const asAnyPayload: {
<TType extends _xylabs_object.DeepRestrictToStringKeys<{
schema: Schema;
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends _xylabs_object.DeepRestrictToStringKeys<{
schema: Schema;
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<_xylabs_object.DeepRestrictToStringKeys<{
schema: Schema;
}>>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T;
declare const asPayload: <T extends Payload>(schema: string[]) => {
<TType extends T>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends T>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<T>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']): (x?: unknown | null) => x is T;
declare const isPayloadOfSchemaTypeWithSources: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is WithSources<T>;
declare const notPayloadOfSchemaType: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is T;
interface PayloadFindFilter {
limit?: number;
order?: 'desc' | 'asc';
schema?: string | string[];
}
declare const PayloadSetSchema: "network.xyo.payload.set";
type PayloadSetSchema = typeof PayloadSetSchema;
interface PayloadSet {
optional?: Record<string, number>;
required?: Record<string, number>;
}
type PayloadSetPayload = Payload<PayloadSet, PayloadSetSchema>;
type SyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => boolean;
type AsyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => Promise<boolean>;
type PayloadValidationFunction<T extends Payload = Payload> = SyncPayloadValidationFunction<T> | AsyncPayloadValidationFunction<T>;
type PayloadProperty<T extends Payload = Payload> = keyof T;
type PayloadValue<T extends Payload = Payload, Key extends PayloadProperty<T> = PayloadProperty<T>> = T[Key];
type PayloadValueExpression<T extends Payload = Payload, Key extends PayloadProperty<T> = PayloadProperty<T>, TValue = PayloadValue<T, Key>> = (payload: T) => TValue;
interface QueryFields {
address?: Address | Address[];
budget?: number;
maxFrequency?: 'once' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
minBid?: number;
}
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>;
interface DataHashStorageMeta {
_dataHash: Hash;
}
type WithDataHashStorageMeta<T extends Payload = Payload> = T & DataHashStorageMeta;
type WithPartialDataHashStorageMeta<T extends Payload = Payload> = Partial<WithDataHashStorageMeta<T>>;
declare const isDataHashStorageMeta: (value: unknown) => value is DataHashStorageMeta;
declare const asDataHashStorageMeta: {
<TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<DataHashStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalDataHashStorageMeta: <TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
interface HashStorageMeta extends DataHashStorageMeta {
_hash: Hash;
}
type WithHashStorageMeta<T extends Payload = Payload> = T & HashStorageMeta;
type WithPartialHashStorageMeta<T extends Payload = Payload> = Partial<WithHashStorageMeta<T>>;
declare const isHashStorageMeta: (value: unknown) => value is HashStorageMeta;
declare const asHashStorageMeta: {
<TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<HashStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalHashStorageMeta: <TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
declare const SequenceComparer: {
local: Compare<Lowercase<string>>;
qualified: Compare<Lowercase<string>>;
};
type LocalSequence = Hex & Exclude<string, 'reserved-local-sequence-value'>;
type QualifiedSequence = Hex & Exclude<string, 'reserved-qualified-sequence-value'>;
type Sequence = LocalSequence | QualifiedSequence;
type Epoch = Hex & Exclude<string, 'reserved-epoch-sequence-value'>;
declare const isEpoch: (value: unknown) => value is Epoch;
type Nonce = Hex & Exclude<string, 'reserved-nonce-sequence-value'>;
declare const isNonce: (value: unknown) => value is Epoch;
declare const isLocalSequence: (value: unknown) => value is Sequence;
declare const isQualifiedSequence: (value: unknown) => value is Sequence;
declare const isSequence: (value: unknown) => value is Sequence;
declare const SequenceNonceComponentLengths: {
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare const SequenceComponentLengths: {
epochBytes: number;
nonceBytes: number;
addressBytes: number;
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare const SequenceComponentMinMax: {
minEpoch: Epoch;
maxEpoch: Epoch;
minNonce: Nonce;
maxNonce: Nonce;
minAddress: Address;
maxAddress: Address;
};
declare const LocalSequenceConstants: {
localSequenceBytes: number;
minLocalSequence: LocalSequence;
maxLocalSequence: LocalSequence;
minEpoch: Epoch;
maxEpoch: Epoch;
minNonce: Nonce;
maxNonce: Nonce;
minAddress: Address;
maxAddress: Address;
epochBytes: number;
nonceBytes: number;
addressBytes: number;
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare const QualifiedSequenceConstants: {
qualifiedSequenceBytes: number;
minQualifiedSequence: QualifiedSequence;
maxQualifiedSequence: QualifiedSequence;
};
declare const SequenceConstants: {
qualifiedSequenceBytes: number;
minQualifiedSequence: QualifiedSequence;
maxQualifiedSequence: QualifiedSequence;
localSequenceBytes: number;
minLocalSequence: LocalSequence;
maxLocalSequence: LocalSequence;
minEpoch: Epoch;
maxEpoch: Epoch;
minNonce: Nonce;
maxNonce: Nonce;
minAddress: Address;
maxAddress: Address;
epochBytes: number;
nonceBytes: number;
addressBytes: number;
nonceIndexBytes: number;
nonceHashBytes: number;
};
declare class SequenceParser {
protected static privateConstructorKey: string;
private readonly data;
protected constructor(privateConstructorKey: string, hex: Hex);
get address(): Address;
get epoch(): Epoch;
get localSequence(): LocalSequence;
get nonce(): Nonce;
get qualifiedSequence(): QualifiedSequence;
static from(sequence: Sequence, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hash, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hex, address?: Address): SequenceParser;
static from(timestamp: Hex, nonce: Nonce, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hash, index?: number, address?: Address): SequenceParser;
static from(timestamp: Hex, hash: Hex, index?: number, address?: Address): SequenceParser;
static from(timestamp: Hex, nonce: Nonce, index?: number, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hash, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hex, address?: Address): SequenceParser;
static from(timestamp: number, nonce: Nonce, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hash, index?: number, address?: Address): SequenceParser;
static from(timestamp: number, hash: Hex, index?: number, address?: Address): SequenceParser;
static from(timestamp: number, nonce: Nonce, index?: number, address?: Address): SequenceParser;
static parse(value: Hex | string | ArrayBufferLike): SequenceParser;
static toEpoch(value: number | Hex | Epoch): Epoch;
static toNonce(value: Hash | Hex, index?: number): Nonce;
}
interface SequenceStorageMeta {
_sequence: Sequence;
}
type WithSequenceStorageMeta<T extends Payload = Payload> = T & SequenceStorageMeta;
type WithPartialSequenceStorageMeta<T extends Payload = Payload> = Partial<WithSequenceStorageMeta<T>>;
declare const isSequenceStorageMeta: (value: unknown) => value is SequenceStorageMeta;
declare const asSequenceStorageMeta: {
<TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<SequenceStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalSequenceStorageMeta: <TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
interface StorageMeta extends SequenceStorageMeta, HashStorageMeta {
}
type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta;
type WithPartialStorageMeta<T extends Payload = Payload> = T & Partial<StorageMeta>;
declare const isStorageMeta: (value: unknown) => value is StorageMeta;
declare const asStorageStorageMeta: {
<TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
<TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<StorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
};
declare const asOptionalStorageMeta: <TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
interface Timestamp {
timestamp: number;
}
type WithTimestamp<T extends EmptyObject = EmptyObject> = T & Timestamp;
export { type AnyPayload, type AsyncPayloadValidationFunction, type DataHashStorageMeta, type Epoch, type HashStorageMeta, type LocalSequence, LocalSequenceConstants, type ModuleError, ModuleErrorSchema, type Nonce, type OverridablePayload, type Payload, type PayloadFields, type PayloadFindFilter, type PayloadProperty, PayloadSchema, type PayloadSet, type PayloadSetPayload, PayloadSetSchema, type PayloadValidationFunction, type PayloadValue, type PayloadValueExpression, type PayloadWithOptionalSources, type PayloadWithSources, type QualifiedSequence, QualifiedSequenceConstants, type Query, type QueryFields, type Schema, type SchemaField, type SchemaFields, type Sequence, SequenceComparer, SequenceComponentLengths, SequenceComponentMinMax, SequenceConstants, SequenceNonceComponentLengths, SequenceParser, type SequenceStorageMeta, type SourcesMetaField, type StorageMeta, type SyncPayloadValidationFunction, type Timestamp, type WithAnySchema, type WithDataHashStorageMeta, type WithHashStorageMeta, type WithOnlyClientMeta, type WithOptionalSchema, type WithOptionalSources, type WithPartialDataHashStorageMeta, type WithPartialHashStorageMeta, type WithPartialSequenceStorageMeta, type WithPartialStorageMeta, type WithPayload, type WithSchema, type WithSequenceStorageMeta, type WithSources, type WithStorageMeta, type WithTimestamp, type WithoutClientMeta, type WithoutMeta, type WithoutPrivateStorageMeta, type WithoutSchema, type WithoutStorageMeta, asAnyPayload, asDataHashStorageMeta, asHashStorageMeta, asOptionalDataHashStorageMeta, asOptionalHashStorageMeta, asOptionalSequenceStorageMeta, asOptionalStorageMeta, asPayload, asSchema, asSequenceStorageMeta, asStorageStorageMeta, isAnyPayload, isDataHashStorageMeta, isEpoch, isHashStorageMeta, isLocalSequence, isModuleError, isNonce, isPayload, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, isQualifiedSequence, isSchema, isSequence, isSequenceStorageMeta, isStorageMeta, notPayloadOfSchemaType };

8

package.json
{
"name": "@xyo-network/payload-model",
"version": "3.8.0",
"version": "3.8.1",
"description": "Primary SDK for using XYO Protocol 2.0",

@@ -46,7 +46,7 @@ "homepage": "https://xyo.network",

"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^4.2.6",
"@xylabs/tsconfig": "^4.2.6",
"@xylabs/ts-scripts-yarn3": "^5.0.22",
"@xylabs/tsconfig": "^5.0.22",
"@xylabs/vitest-extended": "^4.5.1",
"typescript": "^5.7.3",
"vitest": "^3.0.4"
"vitest": "^3.0.5"
},

@@ -53,0 +53,0 @@ "publishConfig": {

@@ -10,3 +10,3 @@ import { isAnyPayload } from './isPayload.ts'

return (x?: unknown | null): x is WithSources<T> =>
isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.$sources !== undefined && Array.isArray(x.$sources)
isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.$sources != undefined && Array.isArray(x.$sources)
}

@@ -13,0 +13,0 @@

@@ -5,2 +5,3 @@ import type { EmptyObject } from '@xylabs/object'

/** Schema type in Javascript is a string */
// eslint-disable-next-line sonarjs/redundant-type-aliases
export type Schema = string

@@ -7,0 +8,0 @@

@@ -14,3 +14,3 @@ import { AsObjectFactory } from '@xylabs/object'

export const isSequenceStorageMeta = (value: unknown): value is SequenceStorageMeta => {
return (value as WithSequenceStorageMeta)?._sequence !== undefined
return (value as WithSequenceStorageMeta)?._sequence != undefined
}

@@ -17,0 +17,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc