Documentation
    Preparing search index...

    State Class

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    actions: Record<string, Action>
    assets_by_role: Record<string, Header[]>
    auth_methods: Record<string, AuthenticationMethod>
    authorize_api_hooks: AuthorizeAccessApiHook[]
    authorize_page_hooks: AuthorizeAccessPageHook[]
    authorize_trigger_hooks: AuthorizeAccessTriggerHook[]
    authorize_view_hooks: AuthorizeAccessViewHook[]
    capacitorPlugins: CapacitorPlugin[]
    codeNPMmodules: Record<string, any>
    codepage_context: Record<string, unknown>
    configs: ConfigTypes
    copilot_skills: CopilotSkill[]
    eventTypes: Record<string, { hasChannel: boolean; name?: string }>
    exchange: Record<string, unknown[]>
    external_tables: Record<string, AbstractTable>
    fields: Field[]
    fileviews: Record<string, FieldView>
    fonts: Record<string, string>
    function_context: Record<string, Function>
    functions: Record<string, Function | PluginFunction>
    hasJoinedCollabSockets: boolean
    hasJoinedDynamicUpdateSockets: boolean
    hasJoinedLogSockets: boolean
    headers: Record<string, Header[]>
    i18n: I18n
    iconSet: Set<string>
    keyFieldviews: Record<string, FieldView>
    keyframes: string[]
    layouts: Record<string, PluginLayout>
    logLevel: number
    mobile_push_handler: Record<string, Function>
    mobileConfig?: MobileConfig
    modelpatterns: Record<string, ModelPattern>
    nodeHandles: Map<string, (payload?: any) => void>
    npm_refresh_in_progess: boolean
    page_groups: PageGroup[]
    pages: Page[]
    plugin_cfgs: Record<string, any>
    plugin_locations: any
    plugin_module_names: any
    plugin_routes: Record<string, PluginRoute[]>
    pluginManager?: any
    plugins: Record<string, Plugin>
    plugins_cfg_context: any
    pushHelper?: PushMessageHelper
    queriesCache?: Record<string, any>
    roles: AbstractRole[]
    routesChangedCb?: Function
    scVersion: string
    sendMessageToWorkers?: Function
    stashed_fieldviews: Record<string, Record<string, FieldView>>
    table_providers: Record<string, TableProvider>
    tables: Table[]
    tenant: string
    triggers: Trigger[]
    types: Record<string, Type>
    userLayouts: Record<string, PluginLayout & { config: GenObj }>
    verifier: any
    views: View[]
    viewtemplates: Record<string, ViewTemplate>
    virtual_triggers: Trigger[]
    waitingWorkflows?: boolean

    Accessors

    • get evaluator(): Evaluator

      Evaluates expressions and {{ }} interpolations, holding the eval_context and a cache of compiled expressions. Built on first use and discarded by invalidate_evaluator() whenever the eval_context changes.

      Returns Evaluator

    Methods

    • Checks plugin authorize_api hooks, for plugin-registered routes with no dedicated model (view/page/trigger) to hang an authorize() method off of. Combine with the caller's own role check.

      Parameters

      • user: any

        the acting user (or undefined/public)

      • opts: {
            action: "get" | "post";
            body?: GenObj;
            req: any;
            route: string;
            state?: GenObj;
        }
        • action: "get" | "post"

          "get" or "post"

        • Optionalbody?: GenObj

          POST body, for action "post"

        • req: any

          the request object, forwarded to hooks

        • route: string

          identifier of the target route/action

        • Optionalstate?: GenObj

          query/state, for action "get"

      Returns Promise<boolean>

    • Deliver a node-handle message on this node/worker. Called from the cross-node/cross-worker message dispatcher (see serve.js).

      Parameters

      • id: string
      • Optionalpayload: any

      Returns void

    • For collaborative editing

      Parameters

      • ten: string
      • type: string
      • data: any
      • viewname: string

        the source view name, used to scope the collab room

      • OptionalnoMultiNodePropagate: boolean

        if true, do not propagate to other nodes in multi-node setup

      Returns void

    • For dynamic updates triggered from a run_js_code action

      Parameters

      • ten: string
      • data: any
      • OptionaluserIds: number[] | null

        array of user IDs to target specific users, null to broadcast to public (unauthenticated) users only, undefined to broadcast to authenticated users only

      • OptionalnoMultiNodePropagate: boolean

        if true, do not propagate to other nodes in multi-node setup

      Returns void

    • emit a log message for the log viewer

      Parameters

      • ten: string
      • min_level: number
      • msg: string
      • OptionalnoMultiNodePropagate: boolean

        if true, do not propagate to other nodes in multi-node setup

      Returns void

    • Send a backup-restore progress update to whoever is watching a restore job. Not persisted anywhere - if no client is currently connected to the job's room, the message is simply dropped.

      Parameters

      • ten: string
      • jobId: string
      • data: any
      • OptionalnoMultiNodePropagate: boolean

        if true, do not propagate to other nodes in multi-node setup

      Returns void

    • Function

      Get all config variables list If variable is not defined that default value is used

      Returns Promise<ConfigTypes>

    • Get config parameter by key

      Parameters

      • key: string

        key of config paramter

      • Optionaldef: any

        default value

      Returns any

    • Get copy of config parameter (which can be safely mutated)

      Parameters

      • key: string

        key of parameter

      • Optionaldef: any

        default value

      Returns any

    • Drop the evaluator so the next use rebuilds it against the current eval_context. Invalidating rather than rebuilding here keeps a burst of registerPlugin() calls at startup to a single rebuild.

      Returns void

    • Returns true if key is defined in fixed_configuration for tenant

      Parameters

      • plugin_name: string
      • key: string

      Returns boolean

    • Refresh State cache for all Saltcorn main objects

      Parameters

      • OptionalnoSignal: boolean

        Do not signal - refresh to other cluster processes.

      • OptionalkeepUnchanged: boolean

        Some members don't need rebuilding if they did not change

      Returns Promise<void>

    • Take the config 'function_code_pages' and build the 'codepage_context' member

      Parameters

      • OptionalnoSignal: boolean

        Do not signal reload to other cluster processes.

      • OptionalkeepUnchanged: boolean

        When 'function_code_pages' didn't change, true skips building it again

      Returns Promise<any>

    • Refresh config

      Parameters

      • OptionalnoSignal: boolean

        Do not signal refresh to other cluster processes.

      Returns Promise<void>

    • Set a config value that will not persist into the db

      Parameters

      • key: string

        config key

      • value: any

        config val

      Returns void

    • Refresh pages

      Parameters

      • OptionalnoSignal: boolean

        Do not signal refresh to other cluster processes.

      Returns Promise<void>

    • Reload plugins

      Parameters

      • OptionalnoSignal: boolean

        Do not signal reload to other cluster processes.

      Returns Promise<void>

    • Refresh tables list and table definitions (including fields) in State

      Parameters

      • OptionalnoSignal: boolean

        Do not signal refresh to other cluster processes.

      Returns Promise<void>

    • Refresh triggers

      Parameters

      • OptionalnoSignal: boolean

        Do not signal refresh to other cluster processes.

      Returns Promise<void>

    • Refresh views

      Parameters

      • OptionalnoSignal: boolean

        Do not signal refresh to other cluster processes.

      Returns Promise<void>

    • Registers a callback so a message sent to this id (from any node) reaches this operation. Call the returned function when done.

      Parameters

      • id: string

        unique id for this operation

      • onMessage: (payload?: any) => void

        called when a message for this id arrives

      Returns () => void

      unregister function

    • Register plugin

      Parameters

      • name: string
      • plugin: Plugin
      • OptionalsetCfg: SingleConfig
      • Optionallocation: string
      • Optionalmodname: string

      Returns void

    • Remove plugin

      Parameters

      • name: string
      • OptionalnoSignal: boolean

        Do not signal removal to other cluster processes.

      Returns Promise<void>

    • Broadcast a message to whichever node/worker has a handler registered for id (see registerNodeHandle). A no-op wherever nothing is registered.

      Parameters

      • id: string
      • Optionalpayload: any

      Returns void

    • Set value of config parameter

      Parameters

      • key: string

        key of parameter

      • value: any

        value of parameter

      Returns Promise<void>

    • Parameters

      • f: Function

        Function to emit dynamic update messages triggered from run_js_code actions

      Returns void