@ptkl/sdk - v1.3.4
    Preparing search index...

    Base client for the platform API Classes that extend PlatformBaseClient have intentins of only working in platform context

    PlatformBaseClient

    The axios instance to use for the client

    // if sdk is used in the forge app that is running in the platform context
    const utils = new ComponentUtils()
    // this won't work outside of platform context because client needs authtorization to communicate with the API.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    client: AxiosInstance
    env: null | string = null
    host: null | string = null
    token: null | string = null

    Methods

    • Execute aggregate pipeline with optional streaming support

      Returns a chainable object that allows both buffered and streaming modes. Call .onData() to enable streaming mode, or await directly for buffered mode.

      Parameters

      Returns AggregateChainable

      Chainable object with streaming methods and Promise interface

      // Buffered response (default, up to 5K documents)
      const result = await component.aggregate([{ $match: { status: 'active' } }]);
      console.log(result.data); // All results at once

      // Streaming response (up to 25K documents)
      await component.aggregate([{ $match: { status: 'active' } }])
      .onData((doc) => console.log('Received:', doc))
      .onError((err) => console.error('Error:', err))
      .onEnd(() => console.log('Stream complete'));
    • Concurrent update model by uuid

      Parameters

      • uuid: string

        string - The uuid of the model

      • version: number

        number - The version of the model

      • data: Record<string, any>
      • options: UpdateOptions

      Returns Promise<AxiosResponse<any, any>>

    • Parameters

      • model: Record<string, any>

      Returns Promise<AxiosResponse<any, any>>

    • Create many models

      Parameters

      Returns Promise<AxiosResponse<any, any>>

    • Parameters

      • uuid: string

      Returns Promise<AxiosResponse<any, any>>

    • Find method to search for models

      Parameters

      • filters: FindParams

        The filters to apply to the search

      • Optionalopts: FindOptions

        The options to apply to the search

      Returns Promise<AxiosResponse<FindResponse, any>>

      • The result of the search
      platform.component(name).find({
      currentPage: 1,
      perPage: 10,
      })

      // advanced search
      platform.component(name).find({
      $adv: {
      name: "John Doe",
      }
      )
    • FindOne method to search for a single model

      Parameters

      Returns Promise<null | Model>

      • The result of the search
      platform.component(name).findOne({
      name: "John Doe",
      })
    • Parameters

      • name: string
      • input: any

      Returns Promise<AxiosResponse<any, any>>

    • Get model by uuid

      Parameters

      • uuid: string

        string - The uuid of the model

      Returns Promise<AxiosResponse<Model, any>>

      (Promise)

    • Modify models by filters

      Parameters

      • filters: Record<string, any>
      • data: Record<string, any>
      • options: ModifyOptions

      Returns Promise<AxiosResponse<any, any>>

    • Parameters

      • uuid: string

      Returns Promise<AxiosResponse<any, any>>

    • Parameters

      • settings: any
      • version: string

      Returns Promise<AxiosResponse<any, any>>

    • Parameters

      • version: string
      • sdkVersion: string
      • engine: string
      • dist: Record<string, string>

      Returns Promise<any>

    • Parameters

      • client: AxiosInstance

      Returns default

    • Returns Promise<AxiosResponse<any, any>>

    • Update model by uuid

      Parameters

      • uuid: string

        string - The uuid of the model

      • data: Record<string, any>
      • options: UpdateOptions

      Returns Promise<AxiosResponse<any, any>>

    • Update many models

      Parameters

      Returns Promise<AxiosResponse<any, any>>

    • Parameters

      • event: string
      • input: any

      Returns Promise<AxiosResponse<any, any>>