@xyo-network/payment-payload-plugins 3.2.5 → 3.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
- import type { PayloadWithSources } from '@xyo-network/payload-model'
1
+ import { AsObjectFactory } from '@xylabs/object'
2
+ import type { PayloadWithSources, WithSources } from '@xyo-network/payload-model'
2
3
  import {
3
4
  isPayloadOfSchemaType,
4
5
  isPayloadOfSchemaTypeWithSources,
@@ -20,8 +21,12 @@ export type Total = PayloadWithSources<TotalFields, TotalSchema>
20
21
  * Identity function for determining if an object is an Total
21
22
  */
22
23
  export const isTotal = isPayloadOfSchemaType<Total>(TotalSchema)
24
+ export const asTotal = AsObjectFactory.create<Total>(isTotal)
25
+ export const asOptionalTotal = AsObjectFactory.createOptional<Total>(isTotal)
23
26
 
24
27
  /**
25
28
  * Identity function for determining if an object is an Total with sources
26
29
  */
27
30
  export const isTotalWithSources = isPayloadOfSchemaTypeWithSources<Total>(TotalSchema)
31
+ export const asTotalWithSources = AsObjectFactory.create<WithSources<Total>>(isTotalWithSources)
32
+ export const asOptionalTotalWithSources = AsObjectFactory.createOptional<WithSources<Total>>(isTotalWithSources)