Configurable Operations

Configurable Operations

LocalizedStringArray

An array of string values in a given LanguageCode, used to define human-readable string values.

Example

const title: LocalizedStringArray = [
  { languageCode: LanguageCode.en, value: 'English Title' },
  { languageCode: LanguageCode.de, value: 'German Title' },
  { languageCode: LanguageCode.zh, value: 'Chinese Title' },
]

Signature

type LocalizedStringArray = Array<Omit<LocalizedString, '__typename'>>

ConfigArgs

A object which defines the configurable arguments which may be passed to functions in those classes which implement the ConfigurableOperationDef interface.

Example

{
  operator: {
    type: 'string',
    config: {
      options: [
        { value: 'startsWith' },
        { value: 'endsWith' },
        { value: 'contains' },
        { value: 'doesNotContain' },
      ],
    },
  },
  term: { type: 'string' },
}

Signature

type ConfigArgs<T extends ConfigArgType> = {
  [name: string]: ConfigArgDef<T>;
}

Members

[index]

property
type:
ConfigArgDef<T>

ConfigurableOperationDef

Defines a ConfigurableOperation, which is a method which can be configured by the Administrator via the Admin API.

Signature

interface ConfigurableOperationDef {
  code: string;
  args: ConfigArgs<any>;
  description: LocalizedStringArray;
}

Members

code

property
type:
string

args

property
type:
ConfigArgs<any>

description

property

ConfigArgType

Certain entities (those which implement ConfigurableOperationDef) allow arbitrary configuration arguments to be specified which can then be set in the admin-ui and used in the business logic of the app. These are the valid data types of such arguments. The data type influences:

  1. How the argument form field is rendered in the admin-ui
  2. The JavaScript type into which the value is coerced before being passed to the business logic.

Signature

type ConfigArgType = 'string' | 'int' | 'float' | 'boolean' | 'datetime' | 'facetValueIds'