Applesauce
    Preparing search index...

    A factory class for building NIP-52 time-based calendar events (kind 31923)

    Hierarchy

    Index

    Constructors

    • Creates a new Promise.

      Parameters

      • executor: (
            resolve: (
                value:
                    | TimeBasedCalendarEventTemplate
                    | PromiseLike<TimeBasedCalendarEventTemplate>,
            ) => void,
            reject: (reason?: any) => void,
        ) => void

        A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

      Returns TimeBasedCalendarEventFactory

    Properties

    _signerRef: SignerRef

    Shared mutable reference to the signer, propagated through all chain links

    "[toStringTag]": string
    "[species]": PromiseConstructor

    Accessors

    • get signer(): EventSigner | undefined

      The signer used to sign the event (reads from shared ref)

      Returns EventSigner | undefined

    • set signer(value: EventSigner | undefined): void

      Parameters

      • value: EventSigner | undefined

      Returns void

    Methods

    • Sets the NIP-31 alt tag for the event

      Parameters

      • alt: string

      Returns this

    • Sets the event signer to use when building this event

      Parameters

      • signer: EventSigner

      Returns this

    • Attaches a callback for only the rejection of the Promise.

      Type Parameters

      • TResult = never

      Parameters

      • Optionalonrejected: ((reason: any) => TResult | PromiseLike<TResult>) | null

        The callback to execute when the Promise is rejected.

      Returns Promise<TimeBasedCalendarEventTemplate | TResult>

      A Promise for the completion of the callback.

    • Custom .then method that wraps the resulting promise in a new event factory

      Parameters

      Returns this

    • Sets the event content

      Parameters

      • content: string

      Returns this

    • Sets the NIP-36 content-warning tag for the event

      Parameters

      • warning: string | boolean

      Returns this

    • Set the event created_at timestamp in seconds. if no value is provided, the current unix timestamp will be used

      Parameters

      • Optionalcreated: number | Date

      Returns this

    • Sets the encrypted content of the event

      Parameters

      • target: string
      • content: string
      • Optionaloverride: EncryptionMethod

      Returns this

    • Sets the NIP-40 expiration timestamp for the event

      Parameters

      • timestamp: number

      Returns this

    • Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

      Parameters

      • Optionalonfinally: (() => void) | null

        The callback to execute when the Promise is settled (fulfilled or rejected).

      Returns Promise<TimeBasedCalendarEventTemplate>

      A Promise for the completion of the callback.

    • Sets the event kind and casts the result to a KnownEventTemplate

      Type Parameters

      • Kind extends number

      Parameters

      Returns EventFactory<Kind, KnownEventTemplate<Kind>>

    • Modifies the events hidden tags array

      Parameters

      • ...args: TagOperation[]

      Returns this

    • Modifies the events public tags array

      Parameters

      • ...args: (TagOperation | undefined)[]

      Returns this

    • Modifies the events public and optional hidden tags

      Parameters

      • ...args: [tagOperations?: ModifyTagsOptions, signer?: EventSigner]

      Returns this

    • Sets the NIP-70 "-" tag for the event

      Parameters

      • isProtected: boolean

      Returns this

    • Signs the event using a signer interface and returns a Promise

      Parameters

      • Optionalsigner: EventSigner

      Returns Promise<KnownEvent<31923>>

    • Stamps the pubkey onto the event template

      Parameters

      • Optionalsigner: EventSigner

      Returns EventFactory<31923, KnownUnsignedEvent<31923>>

    • Strips the pubkey, sig, and id from the event

      Returns EventFactory<31923>

    • Attaches callbacks for the resolution and/or rejection of the Promise.

      Type Parameters

      Parameters

      • Optionalonfulfilled:
            | (
                (
                    value: TimeBasedCalendarEventTemplate,
                ) => TResult1 | PromiseLike<TResult1>
            )
            | null

        The callback to execute when the Promise is resolved.

      • Optionalonrejected: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null

        The callback to execute when the Promise is rejected.

      Returns Promise<TResult1 | TResult2>

      A Promise for the completion of which ever callback is executed.

    • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

      Type Parameters

      • T

      Parameters

      • values: Iterable<T | PromiseLike<T>>

        An iterable of Promises.

      Returns Promise<Awaited<T>[]>

      A new Promise.

    • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

      Type Parameters

      • T extends [] | readonly unknown[]

      Parameters

      • values: T

        An array of Promises.

      Returns Promise<{ -readonly [P in string | number | symbol]: Awaited<T[P]> }>

      A new Promise.

    • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.

      Type Parameters

      • T extends [] | readonly unknown[]

      Parameters

      • values: T

        An array of Promises.

      Returns Promise<
          {
              -readonly [P in string
              | number
              | symbol]: PromiseSettledResult<Awaited<T[P]>>
          },
      >

      A new Promise.

    • Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.

      Type Parameters

      • T

      Parameters

      • values: Iterable<T | PromiseLike<T>>

        An array of Promises.

      Returns Promise<PromiseSettledResult<Awaited<T>>[]>

      A new Promise.

    • The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.

      Type Parameters

      • T extends [] | readonly unknown[]

      Parameters

      • values: T

        An array or iterable of Promises.

      Returns Promise<Awaited<T[number]>>

      A new Promise.

    • The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.

      Type Parameters

      • T

      Parameters

      • values: Iterable<T | PromiseLike<T>>

        An array or iterable of Promises.

      Returns Promise<Awaited<T>>

      A new Promise.

    • Create a new event factory from a nostr event

      Type Parameters

      • K extends number = number

      Parameters

      • event: KnownEvent<K>

      Returns EventFactory<K, KnownEventTemplate<K>>

    • Create a new event factory from a kind

      Type Parameters

      • K extends number

      Parameters

      • kind: K

      Returns EventFactory<K>

    • Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

      Type Parameters

      • T

      Parameters

      • values: Iterable<T | PromiseLike<T>>

        An iterable of Promises.

      Returns Promise<Awaited<T>>

      A new Promise.

    • Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

      Type Parameters

      • T extends [] | readonly unknown[]

      Parameters

      • values: T

        An array of Promises.

      Returns Promise<Awaited<T[number]>>

      A new Promise.

    • Creates a new rejected promise for the provided reason.

      Type Parameters

      • T = never

      Parameters

      • Optionalreason: any

        The reason the promise was rejected.

      Returns Promise<T>

      A new rejected Promise.

    • Creates a new resolved promise.

      Returns Promise<void>

      A resolved promise.

    • Creates a new resolved promise for the provided value.

      Type Parameters

      • T

      Parameters

      • value: T

        A promise.

      Returns Promise<Awaited<T>>

      A promise whose internal state matches the provided promise.

    • Creates a new resolved promise for the provided value.

      Type Parameters

      • T

      Parameters

      • value: T | PromiseLike<T>

        A promise.

      Returns Promise<Awaited<T>>

      A promise whose internal state matches the provided promise.