diff --git a/packages/modules/packages/diviner/packages/hash/src/Payload/HashLease.ts b/packages/modules/packages/diviner/packages/hash/src/Payload/HashLease.ts index 2473c4e0d0..8671af276d 100644 --- a/packages/modules/packages/diviner/packages/hash/src/Payload/HashLease.ts +++ b/packages/modules/packages/diviner/packages/hash/src/Payload/HashLease.ts @@ -1,4 +1,7 @@ -import type { Payload } from '@xyo-network/payload-model' +import { AsObjectFactory } from '@xylabs/object' +import { + isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, type Payload, type WithSources, +} from '@xyo-network/payload-model' export const HashLeaseSchema = 'network.xyo.hash.lease' as const export type HashLeaseSchema = typeof HashLeaseSchema @@ -12,3 +15,17 @@ export type HashLease = Payload< }, HashLeaseSchema > + +/** + * Identity function for HashLease payload + */ +export const isHashLease = isPayloadOfSchemaType(HashLeaseSchema) +export const asHashLease = AsObjectFactory.create(isHashLease) +export const asOptionalHashLease = AsObjectFactory.createOptional(isHashLease) + +/** + * Identity function for HashLease payload with sources + */ +export const isHashLeaseWithSources = isPayloadOfSchemaTypeWithSources>(HashLeaseSchema) +export const asHashLeaseWithSources = AsObjectFactory.create>(isHashLeaseWithSources) +export const asOptionalHashLeaseWithSources = AsObjectFactory.createOptional>(isHashLeaseWithSources)