Skip to main content

Resource

Callable


  • A @Resource is a class decorator and must be placed on top of a class representing a resource.

    • A resource must also extend the AResource class.
    • For type safety, the type of resource being decorated is passed to the decorator.
    @example
    @Resource<MyResource>('@example', 'my-name', MyResourceSchema)
    export class MyResource extends AResource<MyResourceSchema, MyResource> { ... }
    @group

    Decorators

    @see

    Definition of Resources.


    Type parameters

    • T: UnknownResource

    Parameters

    • packageName: string

      The name of the package under which the resource is registered. Selecting a unique package name helps avoid collisions between same resource class names across different libraries. You will reuse the same package name throughout your library for different Octo components you create.

    • resourceName: string

      a string that uniquely represents the name of the resource.

    • schema: Constructable<ResourceSchema<T>>

      The schema of the resource.

    Returns (constructor: any) => void

    The decorated class.

      • (constructor: any): void
      • Parameters

        • constructor: any

        Returns void