@xyo-network/payload-builder
Advanced tools
Comparing version
@@ -5,4 +5,3 @@ import type { Hash } from '@xylabs/hex'; | ||
import { PayloadBuilderBase } from './BuilderBase.ts'; | ||
import type { PayloadBuilderOptions } from './Options.ts'; | ||
export declare class PayloadBuilder<T extends Payload = Payload<AnyObject>, O extends PayloadBuilderOptions<T> = PayloadBuilderOptions<T>> extends PayloadBuilderBase<T, O> { | ||
export declare class PayloadBuilder<T extends Payload = Payload<AnyObject>> extends PayloadBuilderBase<T> { | ||
static addHashMeta<T extends Payload>(payload: T): Promise<WithHashMeta<T>>; | ||
@@ -9,0 +8,0 @@ static addHashMeta<T extends Payload>(payloads: T[]): Promise<WithHashMeta<T>[]>; |
@@ -6,8 +6,8 @@ import type { AnyObject, EmptyObject } from '@xylabs/object'; | ||
export declare const omitSchema: <T extends WithOptionalSchema>(payload: T) => WithoutSchema<T>; | ||
export declare class PayloadBuilderBase<T extends Payload = Payload<AnyObject>, O extends PayloadBuilderOptions<T> = PayloadBuilderOptions<T>> { | ||
readonly options: O; | ||
export declare class PayloadBuilderBase<T extends Payload = Payload<AnyObject>> { | ||
readonly options: PayloadBuilderOptions; | ||
protected _fields?: WithoutMeta<WithoutSchema<T>>; | ||
protected _meta?: WithOnlyClientMeta<T>; | ||
protected _schema: Schema; | ||
constructor(options: O); | ||
constructor(options: PayloadBuilderOptions); | ||
static dataHashableFields<T extends Payload>(schema: Schema, payload: WithoutSchema<T>): Promisable<WithoutMeta<T>>; | ||
@@ -14,0 +14,0 @@ static omitClientMeta<T extends EmptyObject>(payload: T, maxDepth?: number): WithoutClientMeta<T>; |
import type { Logger } from '@xylabs/logger'; | ||
import type { EmptyObject, JsonObject } from '@xylabs/object'; | ||
import type { Schema, WithoutMeta, WithoutSchema } from '@xyo-network/payload-model'; | ||
export interface PayloadBuilderOptions<T extends EmptyObject = EmptyObject> { | ||
readonly fields?: WithoutMeta<WithoutSchema<T>>; | ||
import type { Schema } from '@xyo-network/payload-model'; | ||
export interface PayloadBuilderOptions { | ||
readonly logger?: Logger; | ||
readonly meta?: JsonObject; | ||
readonly schema: Schema; | ||
} | ||
//# sourceMappingURL=Options.d.ts.map |
@@ -5,4 +5,3 @@ import type { Hash } from '@xylabs/hex'; | ||
import { PayloadBuilderBase } from './BuilderBase.ts'; | ||
import type { PayloadBuilderOptions } from './Options.ts'; | ||
export declare class PayloadBuilder<T extends Payload = Payload<AnyObject>, O extends PayloadBuilderOptions<T> = PayloadBuilderOptions<T>> extends PayloadBuilderBase<T, O> { | ||
export declare class PayloadBuilder<T extends Payload = Payload<AnyObject>> extends PayloadBuilderBase<T> { | ||
static addHashMeta<T extends Payload>(payload: T): Promise<WithHashMeta<T>>; | ||
@@ -9,0 +8,0 @@ static addHashMeta<T extends Payload>(payloads: T[]): Promise<WithHashMeta<T>[]>; |
@@ -6,8 +6,8 @@ import type { AnyObject, EmptyObject } from '@xylabs/object'; | ||
export declare const omitSchema: <T extends WithOptionalSchema>(payload: T) => WithoutSchema<T>; | ||
export declare class PayloadBuilderBase<T extends Payload = Payload<AnyObject>, O extends PayloadBuilderOptions<T> = PayloadBuilderOptions<T>> { | ||
readonly options: O; | ||
export declare class PayloadBuilderBase<T extends Payload = Payload<AnyObject>> { | ||
readonly options: PayloadBuilderOptions; | ||
protected _fields?: WithoutMeta<WithoutSchema<T>>; | ||
protected _meta?: WithOnlyClientMeta<T>; | ||
protected _schema: Schema; | ||
constructor(options: O); | ||
constructor(options: PayloadBuilderOptions); | ||
static dataHashableFields<T extends Payload>(schema: Schema, payload: WithoutSchema<T>): Promisable<WithoutMeta<T>>; | ||
@@ -14,0 +14,0 @@ static omitClientMeta<T extends EmptyObject>(payload: T, maxDepth?: number): WithoutClientMeta<T>; |
import type { Logger } from '@xylabs/logger'; | ||
import type { EmptyObject, JsonObject } from '@xylabs/object'; | ||
import type { Schema, WithoutMeta, WithoutSchema } from '@xyo-network/payload-model'; | ||
export interface PayloadBuilderOptions<T extends EmptyObject = EmptyObject> { | ||
readonly fields?: WithoutMeta<WithoutSchema<T>>; | ||
import type { Schema } from '@xyo-network/payload-model'; | ||
export interface PayloadBuilderOptions { | ||
readonly logger?: Logger; | ||
readonly meta?: JsonObject; | ||
readonly schema: Schema; | ||
} | ||
//# sourceMappingURL=Options.d.ts.map |
@@ -5,4 +5,3 @@ import type { Hash } from '@xylabs/hex'; | ||
import { PayloadBuilderBase } from './BuilderBase.ts'; | ||
import type { PayloadBuilderOptions } from './Options.ts'; | ||
export declare class PayloadBuilder<T extends Payload = Payload<AnyObject>, O extends PayloadBuilderOptions<T> = PayloadBuilderOptions<T>> extends PayloadBuilderBase<T, O> { | ||
export declare class PayloadBuilder<T extends Payload = Payload<AnyObject>> extends PayloadBuilderBase<T> { | ||
static addHashMeta<T extends Payload>(payload: T): Promise<WithHashMeta<T>>; | ||
@@ -9,0 +8,0 @@ static addHashMeta<T extends Payload>(payloads: T[]): Promise<WithHashMeta<T>[]>; |
@@ -6,8 +6,8 @@ import type { AnyObject, EmptyObject } from '@xylabs/object'; | ||
export declare const omitSchema: <T extends WithOptionalSchema>(payload: T) => WithoutSchema<T>; | ||
export declare class PayloadBuilderBase<T extends Payload = Payload<AnyObject>, O extends PayloadBuilderOptions<T> = PayloadBuilderOptions<T>> { | ||
readonly options: O; | ||
export declare class PayloadBuilderBase<T extends Payload = Payload<AnyObject>> { | ||
readonly options: PayloadBuilderOptions; | ||
protected _fields?: WithoutMeta<WithoutSchema<T>>; | ||
protected _meta?: WithOnlyClientMeta<T>; | ||
protected _schema: Schema; | ||
constructor(options: O); | ||
constructor(options: PayloadBuilderOptions); | ||
static dataHashableFields<T extends Payload>(schema: Schema, payload: WithoutSchema<T>): Promisable<WithoutMeta<T>>; | ||
@@ -14,0 +14,0 @@ static omitClientMeta<T extends EmptyObject>(payload: T, maxDepth?: number): WithoutClientMeta<T>; |
import type { Logger } from '@xylabs/logger'; | ||
import type { EmptyObject, JsonObject } from '@xylabs/object'; | ||
import type { Schema, WithoutMeta, WithoutSchema } from '@xyo-network/payload-model'; | ||
export interface PayloadBuilderOptions<T extends EmptyObject = EmptyObject> { | ||
readonly fields?: WithoutMeta<WithoutSchema<T>>; | ||
import type { Schema } from '@xyo-network/payload-model'; | ||
export interface PayloadBuilderOptions { | ||
readonly logger?: Logger; | ||
readonly meta?: JsonObject; | ||
readonly schema: Schema; | ||
} | ||
//# sourceMappingURL=Options.d.ts.map |
{ | ||
"name": "@xyo-network/payload-builder", | ||
"version": "3.6.0-rc.9", | ||
"version": "3.6.0-rc.10", | ||
"description": "Primary SDK for using XYO Protocol 2.0", | ||
@@ -32,14 +32,14 @@ "homepage": "https://xyo.network", | ||
"dependencies": { | ||
"@xylabs/assert": "^4.4.18", | ||
"@xylabs/hex": "^4.4.18", | ||
"@xylabs/logger": "^4.4.18", | ||
"@xylabs/object": "^4.4.18", | ||
"@xylabs/promise": "^4.4.18", | ||
"@xyo-network/hash": "^3.6.0-rc.9", | ||
"@xyo-network/payload-model": "^3.6.0-rc.9" | ||
"@xylabs/assert": "^4.4.21", | ||
"@xylabs/hex": "^4.4.21", | ||
"@xylabs/logger": "^4.4.21", | ||
"@xylabs/object": "^4.4.21", | ||
"@xylabs/promise": "^4.4.21", | ||
"@xyo-network/hash": "^3.6.0-rc.10", | ||
"@xyo-network/payload-model": "^3.6.0-rc.10" | ||
}, | ||
"devDependencies": { | ||
"@xylabs/ts-scripts-yarn3": "^4.2.4", | ||
"@xylabs/tsconfig": "^4.2.4", | ||
"@xylabs/vitest-extended": "^4.4.18", | ||
"@xylabs/ts-scripts-yarn3": "^4.2.6", | ||
"@xylabs/tsconfig": "^4.2.6", | ||
"@xylabs/vitest-extended": "^4.4.21", | ||
"typescript": "^5.7.2", | ||
@@ -46,0 +46,0 @@ "vitest": "^2.1.8" |
@@ -13,8 +13,6 @@ import type { Hash } from '@xylabs/hex' | ||
import { PayloadBuilderBase } from './BuilderBase.ts' | ||
import type { PayloadBuilderOptions } from './Options.ts' | ||
export class PayloadBuilder< | ||
T extends Payload = Payload<AnyObject>, | ||
O extends PayloadBuilderOptions<T> = PayloadBuilderOptions<T>, | ||
> extends PayloadBuilderBase<T, O> { | ||
> extends PayloadBuilderBase<T> { | ||
static async addHashMeta<T extends Payload>(payload: T): Promise<WithHashMeta<T>> | ||
@@ -21,0 +19,0 @@ static async addHashMeta<T extends Payload>(payloads: T[]): Promise<WithHashMeta<T>[]> |
@@ -27,4 +27,3 @@ import { assertEx } from '@xylabs/assert' | ||
export class PayloadBuilderBase<T extends Payload = Payload<AnyObject>, | ||
O extends PayloadBuilderOptions<T> = PayloadBuilderOptions<T>> { | ||
export class PayloadBuilderBase<T extends Payload = Payload<AnyObject>> { | ||
protected _fields?: WithoutMeta<WithoutSchema<T>> | ||
@@ -34,8 +33,5 @@ protected _meta?: WithOnlyClientMeta<T> | ||
constructor(readonly options: O) { | ||
const { schema, fields } = options | ||
constructor(readonly options: PayloadBuilderOptions) { | ||
const { schema } = options | ||
this._schema = schema | ||
if (fields) { | ||
this.fields(fields) | ||
} | ||
} | ||
@@ -42,0 +38,0 @@ |
import type { Logger } from '@xylabs/logger' | ||
import type { EmptyObject, JsonObject } from '@xylabs/object' | ||
import type { | ||
Schema, WithoutMeta, WithoutSchema, | ||
} from '@xyo-network/payload-model' | ||
import type { Schema } from '@xyo-network/payload-model' | ||
export interface PayloadBuilderOptions<T extends EmptyObject = EmptyObject> { | ||
readonly fields?: WithoutMeta<WithoutSchema<T>> | ||
export interface PayloadBuilderOptions { | ||
readonly logger?: Logger | ||
readonly meta?: JsonObject | ||
readonly schema: Schema | ||
} |
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
120387
-3.03%1097
-2.83%Updated
Updated
Updated
Updated
Updated